Export (0) Print
Expand All
Expand Minimize

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.

Return codeDescription
Success

SCARD_S_SUCCESS.

Failure

An error code. For more information, see Smart Card Return Values.

 

Remarks

This function is not redirected, but calling the function when inside 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 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 XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Winscard.h

Library

Winscard.lib

DLL

Winscard.dll

Unicode and ANSI names

SCardGetProviderIdW (Unicode) and SCardGetProviderIdA (ANSI)

See also

SCardEstablishContext
SCardListCards
SCardListInterfaces
SCardListReaderGroups
SCardListReaders

 

 

Community Additions

ADD
Show:
© 2015 Microsoft