ICEnroll::enumProviders method (xenroll.h)
[This method is no longer available for use as of Windows Server 2008 and Windows Vista.]
The enumProviders method retrieves the names of the available cryptographic service providers (CSPs) specified by the ProviderType property. This method was first defined in the ICEnroll interface.
Syntax
HRESULT enumProviders(
[in] LONG dwIndex,
[in] LONG dwFlags,
[out] BSTR *pbstrProvName
);
Parameters
[in] dwIndex
Specifies the ordinal position of the CSP whose name will be retrieved. Specify zero for the first CSP.
[in] dwFlags
Specifies flags that are passed through to the CryptEnumProviders function. This parameter is not currently used; specify zero.
[out] pbstrProvName
A pointer to a BSTR variable that receives the name of a CSP with the specified property type. When you have finished using the BSTR, free it by calling the SysFreeString function.
Return value
C++
The return value is an HRESULT. A value of S_OK indicates success. The value ERROR_NO_MORE_ITEMS is returned when there are no more CSPs with the property type indicated by the ProviderType property.VB
The return value is a String variable that contains the name of a CSP. An exception is raised if an error is encountered or when there are no more items.Remarks
If the ProviderType property value has not been set, the default value (usually PROV_RSA_FULL) of ProviderType as set in the registry, is used.
The enumProviders method calls the CryptEnumProviders function.
Examples
BSTR bstrProvName = NULL;
DWORD nProv;
int j;
HRESULT hr;
// array of CSP provider types (see Wincrypt.h)
DWORD nProvType[] = { PROV_RSA_FULL,
PROV_RSA_SIG,
// list shortened for brevity
//...
PROV_STT_ISS };
// Loop, for each Prov Type.
for (j = 0; j < (sizeof(nProvType)/sizeof(DWORD)); j++)
{
nProv = 0;
// pEnroll is previously instantiated ICEnroll interface pointer
hr = pEnroll->put_ProviderType( nProvType[j] );
if ( FAILED(hr))
{
printf("Failed put_ProviderType - %x\n", hr);
goto error;
}
// Enumerate the CSPs of this type.
while ( S_OK == ( hr = pEnroll->enumProviders(nProv,
0,
&bstrProvName)))
{
printf("Provider %ws (type %d )\n", bstrProvName,
nProvType[j] );
nProv++;
if ( bstrProvName )
{
SysFreeString( bstrProvName );
bstrProvName = NULL;
}
}
// Print message if provider type does not have any CSPs.
if ( 0 == nProv )
printf("There were no CSPs of type %d\n", dwType );
}
error:
// Clean up resources, and so on.
if ( bstrProvName )
SysFreeString( bstrProvName );
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | xenroll.h |
Library | Uuid.lib |
DLL | Xenroll.dll |