get_registry_key_security


int get_registry_key_security(handle key,
                              security_information information_type,
                              void* security_descriptor,
                              unsigned* security_descriptor_length)

This function obtains a copy of the security for the key.

Parameters

handle key

The handle of the key whose security is being obtained.

security_information information_type

The type of security information being queried.

void* security_descriptor

A pointer to a buffer to hold the security information for the key.

unsigned* security_descriptor_length

A pointer to a variable holding the size of the buffer provided by the previous parameter. Upon return, the variable contains the number of bytes written to the buffer.

Return

int

0 The function succeeded.
Other The call failed - a Win32 error code is returned.

Notes

To read the owner, group or discretionary access list for the , the caller should have opened the key with access_type::read. To be granted read access to the security descriptor, the caller must be the owner or be mentioned in the discretionary access list of the descriptor.

To read the system access list of the descriptor, the caller must have access_type::system_security. The way to obtain such access is to request it upon opening the key whilst having PrivilegeSecurity enabled.