PC/SC Guide
Prox–DU & Prox–SU
www.gemalto.com
DOC119811A Public Use Page 47/129
SCardGetStatusChange 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 rgReaderStates
SCARD_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 WINAPI SCardGetStatusChange(
__in SCARDCONTEXT hContext,
__in DWORD dwTimeout,
__inout LPSCARD_READERSTATE rgReaderStates,
__in DWORD cReaders
);
Parameters:
hContext [in]
A handle that identifies the resource manager context. The resource manager
context is set by a previous call to the SCardEstablishContext function.
dwTimeout [in]
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 [in, out]
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 [in]
The number of elements in the rgReaderStates array.
Return Value:
This function returns different values depending on whether it succeeds or fails:
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.