Platform SDK: Access Control

ISecurityInformation::GetSecurity

The GetSecurity method requests a security descriptor for the securable object whose security descriptor is being edited. The access control editor calls this method to retrieve the object's current or default security descriptor.

HRESULT GetSecurity(
  SECURITY_INFORMATION RequestedInformation,
  PSECURITY_DESCRIPTOR *ppSecurityDescriptor,
  BOOL fDefault
);

Parameters

RequestedInformation
[in] A set of SECURITY_INFORMATION bit flags that indicate the parts of the security descriptor being requested. This parameter can be a combination of the following values.
Value Meaning
OWNER_SECURITY_INFORMATION If this flag is set, the security descriptor must include the SID of the object's owner.
GROUP_SECURITY_INFORMATION If this flag is set, the security descriptor must include the SID of the object's primary group.
DACL_SECURITY_INFORMATION If this flag is set, the security descriptor must include the object's DACL.
SACL_SECURITY_INFORMATION If this flag is set, the security descriptor must include the object's SACL.

ppSecurityDescriptor
[out] Pointer to a variable that your implementation must set to a pointer to the object's security descriptor. The security descriptor must include the components requested by the RequestedInformation parameter.

The system calls the LocalFree function to free the returned pointer.

fDefault
[in] If this flag is TRUE, ppSecurityDescriptor should return an application-defined default security descriptor for the object. The access control editor uses this default security descriptor to reinitialize the property page.

The access control editor sets this flag to TRUE only if the user clicks the Default button. The Default button is displayed only if you set the SI_RESET flag in the ISecurityInformation::GetObjectInformation method. If no default security descriptor is available, do not set the SI_RESET flag.

If this flag is FALSE, ppSecurityDescriptor should return the object's current security descriptor.

Return Values

Return S_OK if successful.

Return a nonzero error code if an error occurs. Return E_ACCESSDENIED if the user does not have the permission to read the requested security information.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Aclui.h.

See Also

Access Control Editor Overview, Access Control Editor Interfaces, ISecurityInformation::GetObjectInformation, SECURITY_INFORMATION