Platform SDK: Access Control

SetPrivateObjectSecurity

The SetPrivateObjectSecurity function modifies a private object's security descriptor.

To specify whether the protected server supports automatic inheritance of ACEs, use the SetPrivateObjectSecurityEx function.

BOOL SetPrivateObjectSecurity(
  SECURITY_INFORMATION SecurityInformation,        // type
  PSECURITY_DESCRIPTOR ModificationDescriptor,     // new SD
  PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor, // SD
  PGENERIC_MAPPING GenericMapping,                 // mapping 
  HANDLE Token                                     // handle to client token
);

Parameters

SecurityInformation
[in] Indicates the parts of the security descriptor to set. This value can be a combination of the SECURITY_INFORMATION bit flags.
ModificationDescriptor
[in] Pointer to a SECURITY_DESCRIPTOR structure. The parts of this security descriptor indicated by the SecurityInformation parameter are applied to the ObjectsSecurityDescriptor security descriptor.
ObjectsSecurityDescriptor
[out] Pointer to a pointer to a SECURITY_DESCRIPTOR structure. This security descriptor must be in self-relative form.

On input, this is the current security descriptor of the private object. The function modifies it to produce the new security descriptor. If necessary, the SetPrivateObjectSecurityEx function allocates additional memory to produce a larger security descriptor.

GenericMapping
[in] Pointer to a GENERIC_MAPPING structure that specifies the specific and standard access rights that correspond to each of the generic access rights.
Token
[in] Handle to the access token for the client on whose behalf the private object's security is being modified. This parameter is required to ensure that the client has provided a legitimate value for a new owner security identifier (SID). The token must be open for TOKEN_QUERY access.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The SetPrivateObjectSecurity function is successful only if the following conditions are met:

The process calling this function must not be impersonating a client.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Advapi32.lib.

See Also

Client/Server Access Control Overview, Client/Server Access Control Functions, CreatePrivateObjectSecurity, DestroyPrivateObjectSecurity, GENERIC_MAPPING, GetPrivateObjectSecurity, SECURITY_DESCRIPTOR, SECURITY_INFORMATION, SetFileSecurity, SetKernelObjectSecurity, SetPrivateObjectSecurityEx, SetUserObjectSecurity