The CPSetProvParam function allows applications to customize the operations of a CSP.
BOOL CPSetProvParam(
HCRYPTPROV hProv, // in
DWORD dwParam, // in
BYTE *pbData, // in
DWORD dwFlags // in
);
Note The PP_KEYSET_SEC_DESCR flag is not supported under Microsoft Windows 95.
If the function succeeds, TRUE should be returned; otherwise, return FALSE. When FALSE is returned, the appropriate error code (see the following table) must be set via SetLastError.
Error | Description |
---|---|
NTE_BAD_FLAGS | The value of the dwFlags parameter is invalid. |
NTE_BAD_TYPE | The dwParam parameter specifies an unknown parameter number. |
NTE_BAD_UID | The context specified by hProv is invalid. |
NTE_FAIL | The function failed in some unexpected way. |
It is expected that CSP authors will define parameters for this function as necessary. If these are general-purpose in nature, rather than applying to a single provider type, they should be defined in coordination with Microsoft. This will promote cross-vendor standardization, and allow the new parameter numbers to be added to the standard Win32 header files.
Note Some applications will call the CryptSetProvParam function (in the CryptoAPI) with the dwParam parameter set to PP_CLIENT_HWND, in order to specify the window handle that the CSP is to use when interacting with the user. In this case, the application passes in the window handle as a DWORD in the pbData buffer. Applications will typically make this CryptSetProvParam function call before calling CryptAcquireContext (in the CryptoAPI). Because of this, the CryptSetProvParam function is not passed down to the CSP when the parameter is PP_CLIENT_HWND. The CSP obtains this window handle via a virtual function pointer obtained from the CPAcquireContext function call.
CPAcquireContext, CPGetProvParam, CryptSetProvParam