PC/SC Guide
Prox–DU & Prox–SU
www.gemalto.com
DOC119811A Public Use Page 18/129
WinScard API
The next paragraph contains information retrieved from the http://msdn.microsoft.com web
site.
SCardGetProviderId Function
The SCardGetProviderId function returns the identifier (GUID) of the primary service
provider for a given card.
The caller supplies the name of a smart card (previously introduced to the system) and
receives the registered identifier of the primary service provider GUID, if one exists.
Syntax:
LONG WINAPI SCardGetProviderId(
__in SCARDCONTEXT hContext,
__in LPCTSTR szCard,
__out LPGUID pguidProviderId
);
Parameters:
hContext [in]
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.
szCard [in]
Name of the card defined to the system.
pguidProviderId [out]
Identifier (GUID) of the primary service provider. This provider may be activated
using COM, and will supply access to other services in the card.
Return Value:
This function returns different values depending on whether it succeeds or fails:
Success: SCARD_S_SUCCESS.
Failure: An error code. For more information, see Smart Card Return Values.
Remarks:
The SCardGetProviderId 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 how to get the provider ID for the specified card. The example
assumes that hContext is a valid handle obtained from a previous call to the
SCardEstablishContext function and that "MyCardName" was introduced by a previous call
to the SCardIntroduceCardType function.
GUID guidProv;
LONG lReturn;
lReturn = SCardGetProviderId(hContext,