RDF_CARD_TRACKING - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// smclib.h

NTSTATUS (*ReaderFunction[RDF_CARD_TRACKING])(
   PSMARTCARD_EXTENSION SmartcardExtension
);
View the official Windows hardware development documentation

NtDoc

No description available.

Windows hardware development documentation (smartcard-rdf-card-tracking-callback)

RDF_CARD_TRACKING callback function

The RDF_CARD_TRACKING callback function installs an event handler to track every time a card is inserted in or removed from a card reader.

Parameters

Return value

This function returns one of the following NTSTATUS values:

Return code Description
STATUS_PENDING Smart card tracking has started.
STATUS_INVALID_DEVICE_STATE The device cannot accept the request.
STATUS_SUCCESS Smart card status matches the requested tracking call.
STATUS_DEVICE_BUSY A smart card tracking event is pending.

Remarks

It is mandatory for smart card reader drivers to implement this callback function.

Upon receiving an IOCTL_SMARTCARD_IS_PRESENT request, the driver library determines if the smart card is already present. If the smart card is present, the driver library completes the request with a status of STATUS_SUCCESS. If there is no smart card present, the driver library calls the reader driver's smart card tracking callback function, and the reader driver starts looking for the smart card. After initiating smart card tracking, the driver library marks the request as having a status of STATUS_PENDING.

The driver library completes the request.

WDM Device Drivers

The corresponding WDM driver library adds a pointer to the request in SmartcardExtension->OsData->NotificationIrp. The reader driver must complete the request as soon as it detects that a smart card has been inserted or removed. The reader driver completes the request by calling IoCompleteRequest, after which, the reader driver must set the NotificationIrp member of SmartcardExtension -> OsData back to NULL to inform the driver library that the reader driver can accept further smart card tracking requests.

Because this call can have an indefinite duration and the caller can terminate the request before it is complete, it is important to mark this IRP as cancelable.

    MyDriverCardSupervision(
    SmartcardExtension,
    OtherParameters)
    //
    //    This function is called whenever the card status changes
    //    For example, the card has been inserted or the card has been removed
    //
    {
        if (SmartcardExtension->OsData->NotificationOverlappedData != NULL){

            SmartcardCompleteCardTracking(SmartcardExtension);
        }
        //
        // Do additional tasks
        //
    }

Requirements

Target platform Desktop
Header Smclib.h (include Smclib.h)

See also

IoCompleteRequest

IOCTL_SMARTCARD_IS_PRESENT

SMARTCARD_EXTENSION