IOCTL_SMARTCARD_IS_ABSENT

WDM driver version:

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

The operation either returns immediately with STATUS_SUCCESS, which indicates that no card is in the reader, or it returns with STATUS_PENDING. This indicates that a card is currently in the reader and the driver will inform the caller of card removal 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:

IoCompleteRequest(
    Irp,
    IO_NO_INCREMENT
    );

return STATUS_SUCCESS;
 

I/O Status

Information must be set to zero. Status can be:

Status Meaning
STATUS_SUCCESS A smart card is inserted.
STATUS_PENDING The driver is waiting for a card to be inserted.
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_ABSENT DeviceIoControl operation either returns immediately if no card is currently inserted, or it installs an event handler to track card removals.

The operation either returns immediately with STATUS_SUCCESS, which indicates that no card is in the reader, or it returns with STATUS_PENDING. This indicates that a card is currently in the reader and the driver will inform the caller of card removal 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 A smart card is inserted.
STATUS_PENDING The driver is waiting for a card to be inserted.
STATUS_DEVICE_BUSY Event tracking is already active.
STATUS_INVALID_DEVICE_STATE The device cannot accept the request.