SmartcardDeviceControl (WDM) routine

The SmartcardDeviceControl routine is the main entry routine for the smart card driver library. It performs parameter checking and completes calls that do not require I/O to or from the smart card reader.

Syntax

NTSTATUS SmartcardDeviceControl(
   PSMARTCARD_EXTENSION SmartcardExtension,
   DIOCPARAMETERS       *Irp
);

Parameters

  • SmartcardExtension
    A pointer to a SMARTCARD_EXTENSION structure that contains the device extension of the smart card device.

  • Irp
    A pointer to the requesting IRP.

Return value

SmartcardDeviceControl returns the value that was returned to it by the called routine.

Remarks

The driver's DeviceControl routine must call this routine so that the library can check parameters and complete calls that do not require I/O operations to or from the smart card reader.

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

Here is an example of a DeviceControl routine:

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 will call
    // the driver using a callback mechanism.
    return SmartcardDeviceControl(
        &(deviceExtension->SmartcardExtension),
        Irp
        );
}

Requirements

Target platform

Desktop

Version

Available in Windows XP and later versions of Windows.

Header

Smclib.h (include Smclib.h)

Library

Smclib.lib

IRQL

PASSIVE_LEVEL

See also

SMARTCARD_EXTENSION

 

 

Send comments about this topic to Microsoft