Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CryptEnumProviderTypes

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function retrieves the first or next type of cryptographic service provider (CSP) supported on the computer. Used in a loop, this function retrieves in sequence all of the CSP types available on a computer.


BOOL WINAPI CryptEnumProviderTypes( 
  DWORD dwIndex,
  DWORD* pdwReserved, 
  DWORD dwFlags, 
  DWORD* pdwProvType,
  LPTSTR pszTypeName, 
  DWORD* pcbTypeName
);

dwIndex

[in] Specifies the index of the next provider type to be enumerated.

pdwReserved

[in] Reserved for future use and must be set to NULL.

dwFlags

[in] Reserved for future use and must be set to zero.

pdwProvType

[in] Pointer to the DWORD value that designates the enumerated provider type.

pszTypeName

[out] Pointer to a buffer that receives a null-terminated string from the enumerated provider type. When the provider types have no friendly names, no name is returned and the DWORD value pointed to by pcbTypeName is zero.

This parameter can be NULL if you want to get the size of the name for memory allocation purposes.

pcbTypeName

[in, out] On input, pointer to a DWORD value that specifies the size, in bytes, of the buffer pointed to by the pszTypeName parameter. On output, the DWORD value contains the number of bytes stored in the buffer. When the provider types have no friendly names, no name is returned and the DWORD value pointed to by pcbTypeName is zero.

When processing the data returned in the buffer, applications must use the actual size of the data returned. The actual size may be slightly smaller than the size of the buffer specified on input. On input, buffer sizes are usually specified large enough to ensure that the largest possible output data will fit in the buffer. On output, the variable pointed to by this parameter is updated to reflect the actual size of the data copied to the buffer.

TRUE indicates success. FALSE indicates failure. To get extended error information, call the GetLastError function.

The following table shows the common values for the GetLastError function. The error values prefaced by NTE are generated by the particular CSP you are using.

Value Description

ERROR_NO_MORE_ITEMS

There are no more items to enumerate.

ERROR_NOT_ENOUGH_MEMORY

The operating system ran out of memory.

NTE_BAD_FLAGS

dwFlags has an unrecognized value.

NTE_FAIL

Something was wrong with the type registration.

This function enumerates the provider types on a device. Once this is done, the providers for a specific type may be enumerated by using the CryptEnumProviders function.

Windows Embedded CE does not support the ANSI version of this function.

long i;
DWORD dwErr;
// Loop through enumerating provider types.
for (i=0;;i++)
{
if (!CryptEnumProviderTypes(i, NULL, 0, &dwType, NULL, NULL))
 {if (ERROR_NO_MORE_ITEMS != (dwErr = GetLastError()))
 {printf("ERROR - CryptEnumProviderTypes : %X\n", dwErr);
 }
 break;
 }
printf ("Provider Type %d\n", dwType);
}

Headerwincrypt.h
Librarycoredll.lib
Windows Embedded CEWindows CE 2.10 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show:
© 2015 Microsoft