NCryptEnumStorageProviders function (ncrypt.h)

The NCryptEnumStorageProviders function obtains the names of the registered key storage providers.


SECURITY_STATUS NCryptEnumStorageProviders(
  [out] DWORD              *pdwProviderCount,
  [out] NCryptProviderName **ppProviderList,
  [in]  DWORD              dwFlags


[out] pdwProviderCount

The address of a DWORD to receive the number of elements in the ppProviderList array.

[out] ppProviderList

The address of an NCryptProviderName structure pointer to receive an array of the registered key storage provider names. The variable pointed to by the pdwProviderCount parameter receives the number of elements in this array.

When this memory is no longer needed, free it by passing this pointer to the NCryptFreeBuffer function.

[in] dwFlags

Flags that modify function behavior. This can be zero (0) or the following value.

Value Meaning
Requests that the key service provider (KSP) not display any user interface. If the provider must display the UI to operate, the call fails and the KSP should set the NTE_SILENT_CONTEXT error code as the last error.

Return value

Returns a status code that indicates the success or failure of the function.

Possible return codes include, but are not limited to, the following.

Return code Description
The function was successful.
The dwFlags parameter contains a value that is not valid.
One or more parameters are not valid.
A memory allocation failure occurred.


A service must not call this function from its StartService Function. If a service calls this function from its StartService function, a deadlock can occur, and the service may stop responding.


Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header ncrypt.h
Library Ncrypt.lib
DLL Ncrypt.dll

See also