Skip to content

Latest commit

 

History

History
71 lines (46 loc) · 3.31 KB

wdm-reader-driver.md

File metadata and controls

71 lines (46 loc) · 3.31 KB
title description keywords ms.date
WDM Reader Driver
WDM Reader Driver
vendor-supplied drivers WDK smart card , required routines
WDM WDK smart card
04/20/2017

WDM Reader Driver

Required routines

The following routines are required by a WDM reader driver.

Initializes the driver object and the dispatch table.

Creates a device object for the smart card reader. In addition, AddDevice can call any of the following driver library routines:

Removes the driver from the system.

-and-

Supports IRP_MJ_CREATE and IRP_MJ_CLOSE&lt, respectively. To establish a connection to the reader, the resource manager sends IRP_MJ_CREATE to the reader driver. To sever the connection, the resource manager sends IRP_MJ_CLOSE.

Supports IRP_MJ_CLEANUP, which the resource manager sends to the reader driver to cancel pending I/O requests.

Supports IRP_MJ_PNP

Supports IRP_MJ_POWER.

Supports IRP_MJ_DEVICE_CONTROL and is the main entry point for smart card requests. Upon receiving IRP_MJ_DEVICE_CONTROL, DispatchDeviceControl must immediately call SmartcardDeviceControl (WDM), which is the smart card driver library routine that handles device-control requests. The following code example shows how to call this library routine from a WDM driver:

NTSTATUS
DriverDeviceControl(
    PDEVICE_OBJECT DeviceObject,
    PIRP Irp
    )
{
    PDEVICE_EXTENSION deviceExtension = DeviceObject -> DeviceExtension;

    return SmartcardDeviceControl(
        &(deviceExtension->SmartcardExtension),
        Irp
        );

If it is unable to handle the particular IOCTL that is indicated in the call, SmartcardDeviceControl will call the driver's callback for unknown IOCTL requests.