Compartilhar via


SCardListCards

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function searches the smart card database and provides a list of named cards previously introduced to the system by a user.

The caller specifies an Automatic Terminal Recognition (ATR) string, a set of globally unique identifiers (GUIDs), or both. If both an ATR string and an identifier array are supplied, the cards returned will match the ATR string supplied and support the interfaces specified.

Syntax

LONG SCardListCards(
  SCARDCONTEXT hContext, 
  LPCBYTE pbAtr, 
  LPCGUID rgguidInterfaces, 
  DWORD cguidInterfaceCount, 
  LPTSTR mszCards, 
  LPDWORD pcchCards 
);

Parameters

  • hContext
    [in] Handle to the resource manager context for the query. The resource manager context can be set by a previous call to SCardEstablishContext or set to NULL if the query is not directed toward a specific context.
  • pbAtr
    [in] Pointer to the address of an ATR string to compare to known cards or NULL if no ATR matching is to be performed.
  • rgguidInterfaces
    [in] Supplies an array of GUIDs or NULL if no interface matching is to be performed. When an array is supplied, a card name is returned only if all the specified identifiers are supported by the card.
  • cguidInterfaceCount
    [in] Count of entries in the rgguidInterfaces array. If rgguidInterfaces is NULL, then this value is ignored.
  • mszCards
    [out] Receives a multi-string that lists the smart cards found. If this value is NULL, SCardListCards ignores the buffer length supplied in pcchCards, returning the length of the buffer that would have been returned if this parameter had not been NULL to pcchCards and a success code.
  • pcchCards
    [in, out] Pointer to the length of the mszCards buffer in characters. Receives the actual length of the multi-string structure, including all trailing null characters. If the buffer length is specified as SCARD_AUTOALLOCATE, mszCards is converted to a pointer to a byte pointer, and receives the address of a block of memory containing the multi-string structure. This block of memory must be deallocated with SCardFreeMemory.

Return Value

The following table shows the possible return values.

Value Description

SCARD_S_SUCCESS

Succeeds

An error value (see Smart Card Error Values for a list of all error values).

Fails

Remarks

To return all smart cards introduced to the subsystem, set pbAtr and rgguidInterfaces to NULL.

SCardListCards is a database query function.

Requirements

Header winscard.h
Library winscard.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

SCardEstablishContext
SCardGetProviderId
SCardListInterfaces
SCardListReaders