Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
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 SCardEstablishContextor 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 rgguidInterfacesarray. If rgguidInterfacesis NULL, then this value is ignored.

mszCards

[out] Receives a multi-string that lists the smart cards found. If this value is NULL, SCardListCardsignores 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 pcchCardsand a success code.

pcchCards

[in, out] Pointer to the length of the mszCardsbuffer 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, mszCardsis 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 Valuesfor a list of all error values).

Fails

Remarks

To return all smart cards introduced to the subsystem, set pbAtrand rgguidInterfacesto NULL.

SCardListCardsis 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