SmartcardDeviceControl (VxD)

The SmartcardDeviceControl function is the main entry function for the smart card driver library. It checks parameters and completes calls that do not require I/O with the reader.

NTSTATUS 
SmartcardDeviceControl(
  IN PSMARTCARD_EXTENSION SmartcardExtension,
  IN LPDIOC DiocParams
);
 

Parameters

SmartcardExtension
Points to the smart card structure of the driver.
DiocParams
Points to the requesting DIOCPARAMETERS structure.

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 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:

DWORD
DriverName_DeviceIoControl(
  DWORD  dwService,
  DWORD  dwDDB,
  DWORD  hDevice,
  LPDIOC lpDiocParms)
)
{
    NTSTATUS status;

    // Let the library check parameters 
    // If the library requires the help of the driver it'll call
    // the driver using a call back mechanism
    status = SmartcardDeviceControl(
        &SmartcardExtension,
        lpDiocParams
        );

    return MapNtStatusToWinError(status);
}
 

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