Previous Next

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
Pointer to a structure of type SMARTCARD_EXTENSION that contains the device extension of the smart card device.
Irp
Pointer to the requesting IRP.

Return Value

SmartcardDeviceControl returns the NTSTATUS value of the called routine.

Headers

Declared in smclib.h. Include smclib.h.

Comments

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

See Also

SmartcardDeviceControl (VxD)