PC/SC Guide
Prox–DU & Prox–SU
www.gemalto.com
DOC119811A Public Use Page 21/129
Success: SCARD_S_SUCCESS.
Failure: An error code. For more information, see Smart Card Return Values.
Remarks:
To return all smart cards introduced to the subsystem, set pbAtr and rgguidInterfaces to
NULL.
The SCardListCards function is a database query function. For more information on other
database query functions, see Smart Card Database Query Functions.
Examples:
The following example shows listing of the smart cards.
LPTSTR pmszCards = NULL;
LPTSTR pCard;
LONG lReturn;
DWORD cch = SCARD_AUTOALLOCATE;
// Retrieve the list of cards.
lReturn = SCardListCards(NULL,
NULL,
NULL,
NULL,
(LPTSTR)&pmszCards,
&cch );
if ( SCARD_S_SUCCESS != lReturn )
{
printf("Failed SCardListCards\n");
exit(1); // Or other appropriate error action
}
// Do something with the multi string of cards.
// Output the values.
// A double-null terminates the list of values.
pCard = pmszCards;
while ( '\0' != *pCard )
{
// Display the value.
printf("%S\n", pCard );
// Advance to the next value.
pCard = pCard + wcslen(pCard) + 1;
}
// Remember to free pmszCards (by calling SCardFreeMemory).
// ...