IOCTL_SMARTCARD_IS_PRESENT

WDM driver version:

The IOCTL_SMARTCARD_IS_PRESENT DeviceIoControl operation either returns immediately if no card is currently inserted, or it installs an event handler to track card insertions.

The operation either returns immediately with STATUS_SUCCESS, which indicates that a card is already in the reader, or it returns with STATUS_PENDING, which indicates that no card is currently in the reader. In this case, the driver then informs the caller of card insertion through an I/O completion. Waiting for I/O completion can be accomplished with the following code fragment:

success = GetOverlappedResult(
    hDevice,
    &lpOverlapped,
    &lpBytesReturned,
    TRUE);
 

I/O Status

Information must be set to zero. Status can be:

Status Meaning
STATUS_SUCCESS No smart card is currently inserted.
STATUS_PENDING The driver is waiting for a card to be removed.
STATUS_DEVICE_BUSY Event tracking is already active.
STATUS_INVALID_DEVICE_STATE The device cannot accept the request.

VxD driver version:

The IOCTL_SMARTCARD_IS_PRESENT DeviceIoControl operation either returns immediately if no card is currently inserted, or it installs an event handler to track card insertions.

The operation either returns immediately with STATUS_SUCCESS, which indicates that a card is already in the reader, or it returns with STATUS_PENDING, which indicates that no card is currently in the reader. In this case, the driver then informs the caller of card insertion through an I/O completion. Waiting for I/O completion can be accomplished with the following code fragment:

success = GetOverlappedResult(
    hDevice,
    &lpOverlapped,
    &lpBytesReturned,
    TRUE);
 

Completing the call in the driver can be accomplished with the following code fragment:

SmartcardCompleteCardTracking(
  SmartcardExtension
);
 

Return Values

Following are possible return values.

Value Meaning
STATUS_SUCCESS No smart card is currently inserted.
STATUS_PENDING The driver is waiting for a card to be removed.
STATUS_DEVICE_BUSY Event tracking is already active.
STATUS_INVALID_DEVICE_STATE The device cannot accept the request.