The SmartcardDeviceControl function is the main entry function for the smart card driver library. It performs parameter checking and completes calls that do not require I/O with the reader.
NTSTATUS
SmartcardDeviceControl(
IN PSMARTCARD_EXTENSION SmartcardExtension,
IN PIRP Irp
);
SmartcardDeviceControl returns the NTSTATUS value of the called routine.
Declared in smclib.h. Include smclib.h.
The driver’s DeviceControl routine must call this function to let the library check parameters and complete calls that do not need I/O from the reader.
The smart card driver library checks the version of the SMARTCARD_EXTENSION structure. The driver must assign SMCLIB_VERSION value to the Version member of SMARTCARD_EXTENSION before calling SmartcardDeviceControl. This is usually done in the DriverEntry routine.
The following is an example of a DeviceControl function.
NTSTATUS
DeviceControl(
PDEVICE_OBJECT DeviceObject,
PIRP Irp
)
{
PDEVICE_EXTENSION deviceExtension = DeviceObject->DeviceExtension;
// Let the library check parameters
// If the library requires the help of the driver it’ll call
// the driver using a callback mechanism
return SmartcardDeviceControl(
&(deviceExtension->SmartcardExtension),
Irp
);
}