SCardSetCardTypeProviderNameW function (winscard.h)
The SCardSetCardTypeProviderName function specifies the name of the module (dynamic link library) containing the provider for a given card name and provider type.
Syntax
LONG SCardSetCardTypeProviderNameW(
[in] SCARDCONTEXT hContext,
[in] LPCWSTR szCardName,
[in] DWORD dwProviderId,
[in] LPCWSTR szProvider
);
Parameters
[in] hContext
Handle that identifies the resource manager context. The resource manager context can be set by a previous call to SCardEstablishContext. This value can be NULL if the call to SCardSetCardTypeProviderName is not directed to a specific context.
[in] szCardName
Name of the card type with which this provider name is associated.
[in] dwProviderId
Identifier for the provider associated with this card type.
Value | Meaning |
---|---|
|
The function retrieves the name of the smart card's primary service provider as a GUID string. |
|
The function retrieves the name of the cryptographic service provider (CSP). |
|
The function retrieves the name of the smart card key storage provider (KSP). |
|
The function retrieves the name of the card module. |
[in] szProvider
A string that contains the provider name that is representing the CSP.
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 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.
This function sets the provider name, while SCardGetCardTypeProviderName can be used to retrieve the provider name.
Examples
The following example shows how to specify the card type provider name.
LPTSTR szNewProvName = _T("My Provider Name");
LPTSTR szCardName = _T("WindowsCard");
LONG lReturn = SCARD_S_SUCCESS;
// Set the card type provider name.
// hContext was set by SCardEstablishContext.
lReturn = SCardSetCardTypeProviderName(hContext,
szCardName,
SCARD_PROVIDER_CSP,
szNewProvName);
if ( SCARD_S_SUCCESS != lReturn )
{
printf("Failed SCardSetCardTypeProviderName - %x\n", lReturn);
exit(1);
}
Note
The winscard.h header defines SCardSetCardTypeProviderName 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 |