SmartcardDeviceControl (WDM)

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
);
 

Parameters

SmartcardExtension
Points to the smart card structure of the driver.
Irp
Points to the requesting IRP.

Return Values

SmartcardDeviceControl returns the NTSTATUS value of the called routine.

Remarks

The driver's DeviceControl routine must call this function to let the library check parameters and complete calls that do not need to do I/O with the reader.

The smart card driver library checks the version of the SMARTCARD_EXTENSION structure. Before calling SmartcardDeviceControl, the driver must assign to the Version member of SMARTCARD_EXTENSION the value SMCLIB_VERSION. This is usually done in the DriverEntry routine.

A DeviceControl function should look like the following:

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 call back mechanism
    return SmartcardDeviceControl(
        &(deviceExtension->SmartcardExtension),
        Irp
        );
}
 

For information on the SmartcardDeviceControl function for VxD drivers, see SmartcardDeviceControl (VxD).