SCardGetProviderId function
Applies to: desktop apps only
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.
| Return code | Description |
|---|---|
|
SCARD_S_SUCCESS. |
|
An error code. For more information, see Smart Card Return Values. |
Remarks
This function is not redirected. Calling the function SCardGetProviderId when attempting a Remote Desktop session fails with the SCARD_E_READER_UNAVAILABLE error code.
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,
L"MyCardName",
&guidProv);
if ( SCARD_S_SUCCESS != lReturn )
printf("Failed SCardGetProviderId - %x\n", lReturn);
else
{
// Use the provider GUID as needed.
// ...
}
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names | SCardGetProviderIdW (Unicode) and SCardGetProviderIdA (ANSI) |
See also
Send comments about this topic to Microsoft
Build date: 3/13/2012