SCardListInterfacesA function (winscard.h)
The SCardListInterfaces function provides a list of interfaces supplied by a given card.
The caller supplies the name of a smart card previously introduced to the subsystem, and receives the list of interfaces supported by the card.
Syntax
LONG SCardListInterfacesA(
[in] SCARDCONTEXT hContext,
[in] LPCSTR szCard,
[out] LPGUID pguidInterfaces,
[in, out] LPDWORD pcguidInterfaces
);
Parameters
[in] hContext
Handle that identifies the resource manager context for the query. The resource manager context can be set by a previous call to SCardEstablishContext. This parameter cannot be NULL.
[in] szCard
Name of the smart card already introduced to the smart card subsystem.
[out] pguidInterfaces
Array of interface identifiers (GUIDs) that indicate the interfaces supported by the smart card. If this value is NULL, SCardListInterfaces ignores the array length supplied in pcguidInterfaces, returning the size of the array that would have been returned if this parameter had not been NULL to pcguidInterfaces and a success code.
[in, out] pcguidInterfaces
Size of the pcguidInterfaces array, and receives the actual size of the returned array. If the array size is specified as SCARD_AUTOALLOCATE, then pcguidInterfaces is converted to a pointer to a GUID pointer, and receives the address of a block of memory containing the array. This block of memory must be deallocated with SCardFreeMemory.
Return value
This function returns different values depending on whether it succeeds or fails.
Return code | Description |
---|---|
|
SCARD_S_SUCCESS. |
|
An error code. For more information, see Smart Card Return Values. |
Remarks
This function is not redirected, but calling the function when attempting a Remote Desktop session will not result in an error. It only means that the result will be from the remote computer instead of the local computer.
The SCardListInterfaces 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 the interfaces for a smart card.
LPGUID pGuids = NULL;
LONG lReturn;
DWORD cGuid = SCARD_AUTOALLOCATE;
// Retrieve the list of interfaces.
lReturn = SCardListInterfaces(NULL,
(LPCSTR) "MyCard",
(LPGUID)&pGuids,
&cGuid );
if ( SCARD_S_SUCCESS != lReturn )
{
printf("Failed SCardListInterfaces\n");
exit(1); // Or other appropriate action
}
if ( 0 != cGuid )
{
// Do something with the array of Guids.
// Remember to free pGuids when done (by SCardFreeMemory).
// ...
}
Note
The winscard.h header defines SCardListInterfaces as an alias that 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 is 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 |