NCryptSetProperty function
The NCryptSetProperty function sets the value for a named property for a CNG key storage object.
Syntax
SECURITY_STATUS WINAPI NCryptSetProperty( _In_ NCRYPT_HANDLE hObject, _In_ LPCWSTR pszProperty, _In_ PBYTE pbInput, _In_ DWORD cbInput, _In_ DWORD dwFlags );
Parameters
- hObject [in]
-
The handle of the key storage object to set the property for.
- pszProperty [in]
-
A pointer to a null-terminated Unicode string that contains the name of the property to set. This can be one of the predefined Key Storage Property Identifiers or a custom property identifier.
- pbInput [in]
-
The address of a buffer that contains the new property value. The cbInput parameter contains the size of this buffer.
- cbInput [in]
-
The size, in bytes, of the pbInput buffer.
- dwFlags [in]
-
Flags that modify function behavior. This can be zero or a combination of one or more of the following values.
For the NCRYPT_SECURITY_DESCR_PROPERTY property, this parameter must also contain one of the following values, which identifies the part of the security descriptor to set.
Value Meaning - OWNER_SECURITY_INFORMATION
Set the security identifier (SID) of the object's owner. Use the SetSecurityDescriptorOwner function to set the owner SID in the SECURITY_DESCRIPTOR structure.
- GROUP_SECURITY_INFORMATION
Set the SID of the object's primary group. Use the SetSecurityDescriptorGroup function to set the group SID in the SECURITY_DESCRIPTOR structure.
- DACL_SECURITY_INFORMATION
Set the discretionary access control list (DACL). Use the SetSecurityDescriptorSacl function to set the DACL in the SECURITY_DESCRIPTOR structure.
- SACL_SECURITY_INFORMATION
Set the system access control list (SACL). Use the SetSecurityDescriptorDacl function to set the SACL in the SECURITY_DESCRIPTOR structure.
- LABEL_SECURITY_INFORMATION
Set the mandatory label access control entry in the SACL of the object. Use the SetSecurityDescriptorDacl function to set the SACL in the SECURITY_DESCRIPTOR structure. For more information about the mandatory label access control entry, see Windows Integrity Mechanism Design.
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. |
|
The hObject parameter is not valid. |
|
One or more parameters are not valid. |
|
A memory allocation failure occurred. |
|
The specified property is not supported for the object. |
Remarks
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.
Requirements
|
Minimum supported client |
Windows Vista [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2008 [desktop apps | Windows Store apps] |
|
Header |
|
|
Library |
|
|
DLL |
|