SCardLocateCardsByATRW function (winscard.h)

The SCardLocateCardsByATR function searches the readers listed in the rgReaderStates parameter for a card with a name that matches one of the card names contained in one of the SCARD_ATRMASK structures specified by the rgAtrMasks parameter.

Syntax

LONG SCardLocateCardsByATRW(
  [in]      SCARDCONTEXT         hContext,
  [in]      LPSCARD_ATRMASK      rgAtrMasks,
  [in]      DWORD                cAtrs,
  [in, out] LPSCARD_READERSTATEW rgReaderStates,
  [in]      DWORD                cReaders
);

Parameters

[in] hContext

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

[in] rgAtrMasks

Array of SCARD_ATRMASK structures that contain the names of the cards for which to search.

[in] cAtrs

Number of elements in the rgAtrMasks array.

[in, out] rgReaderStates

Array of SCARD_READERSTATE structures that specify the readers to search, and receive the result.

[in] cReaders

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
Error code. For more information, see Smart Card Return Values.

Remarks

This service is especially useful when used in conjunction with SCardGetStatusChange. If no matching cards are found by means of SCardLocateCards, the calling application may use SCardGetStatusChange to wait for card availability changes.

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

Note

The winscard.h header defines SCardLocateCardsByATR as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
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