Platform SDK: Cryptography

CPSetProvParam

The CPSetProvParam function customizes the operations of a cryptographic service provider (CSP).

BOOL CPSetProvParam(
  HCRYPTPROV hProv,  // in
  DWORD dwParam,     // in
  BYTE *pbData,      // in
  DWORD dwFlags      // in
);

Parameters

hProv
Handle to a key container within the CSP. This handle is obtained by a call to CPAcquireContext.
dwParam
Customizable parameter to set. The only currently defined parameter value is:
PP_KEYSET_SEC_DESCR
Sets the security descriptor of a registry entry where the key set is stored. The new value is contained in pbData. For details on manipulating ACLs, see Secperf.c in the Microsoft Platform SDK.

Windows 95 does not support this flag.

Customizable parameters can be added as needed. General-purpose parameters can be defined in coordination with Microsoft Corporation to promote cross-vendor standardization and allow the new parameter numbers to be added to the standard Microsoft® Win32® header files.

pbData
On entry to the function, this buffer contains data as specified by the dwParam parameter. The form and length of this data varies depending on dwParam.
dwFlags
If pdParam is PP_KEYSET_SEC_DESCR, dwFlags contains the SECURITY_INFORMATION applicable bit flags. These can be combined with a bitwise OR operation. The following table lists defined SECURITY_INFORMATION flags.
Value Meaning
OWNER_SECURITY_INFORMATION Indicates the owner identifier of the object being referenced.
GROUP_SECURITY_INFORMATION Indicates the primary group identifier of the object being referenced.
DACL_SECURITY_INFORMATION Indicates the discretionary ACL of the object being referenced.
SACL_SECURITY_INFORMATION Indicates the system ACL of the object being referenced.

Return Values

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE, and the appropriate error code from the following table must be set using 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 an unexpected way.

Remarks

Applications can call CryptSetProvParam with the dwParam parameter set to PP_CLIENT_HWND to specify the window handle the CSP is to use when interacting with the user. The call to CryptSetProvParam passes in the window handle as a DWORD value in the pbData buffer.

Applications call CryptSetProvParam before calling CryptAcquireContext; therefore, calls to CPSetProvParam with the PP_CLIENT_HWND parameter are not made. The CSP obtains this window handle using a virtual function pointer obtained from the CPAcquireContext function call.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 OSR2 or later (or Windows 95 with Internet Explorer 3.02 or later).
  Header: Declared in Wincrypt.h.

See Also

CPAcquireContext, CPGetProvParam, CryptSetProvParam