SCardGetStatusChangeA function

The SCardGetStatusChange function blocks execution until the current availability of the cards in a specific set of readers changes.

The caller supplies a list of readers to be monitored by an SCARD_READERSTATE array and the maximum amount of time (in milliseconds) that it is willing to wait for an action to occur on one of the listed readers. Note that SCardGetStatusChange uses the user-supplied value in the dwCurrentState members of the rgReaderStatesSCARD_READERSTATE array as the definition of the current state of the readers. The function returns when there is a change in availability, having filled in the dwEventState members of rgReaderStates appropriately.

Syntax

LONG SCardGetStatusChangeA(
  SCARDCONTEXT         hContext,
  DWORD                dwTimeout,
  LPSCARD_READERSTATEA rgReaderStates,
  DWORD                cReaders
);

Parameters

hContext

A handle that identifies the resource manager context. The resource manager context is set by a previous call to the SCardEstablishContext function.

dwTimeout

The maximum amount of time, in milliseconds, to wait for an action. A value of zero causes the function to return immediately. A value of INFINITE causes this function never to time out.

rgReaderStates

An array of SCARD_READERSTATE structures that specify the readers to watch, and that receives the result.

To be notified of the arrival of a new smart card reader, set the szReader member of a SCARD_READERSTATE structure to "\\?PnP?\Notification", and set all of the other members of that structure to zero.

Important  Each member of each structure in this array must be initialized to zero and then set to specific values as necessary. If this is not done, the function will fail in situations that involve remote card readers.
 

cReaders

The number of elements in the rgReaderStates array.

Return Value

This function returns different values depending on whether it succeeds or fails.

Return code Description
Success
SCARD_S_SUCCESS.
Failure
An error code. For more information, see Smart Card Return Values.

Remarks

The SCardGetStatusChange function is a smart card tracking function. For more information about other tracking functions, see Smart Card Tracking Functions.

Examples

For information about how to call this function, see the example in SCardLocateCards.

Requirements

   
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winscard.h
Library Winscard.lib
DLL Winscard.dll

See Also

SCARD_READERSTATE

SCardCancel

SCardEstablishContext

SCardLocateCards