AddAccessAllowedAceEx

[This is preliminary documentation and subject to change.]

The AddAccessAllowedAceEx function adds an access-allowed ACE to the end of a DACL. This function is identical to the AddAccessAllowedAce function, except that it allows you to also specify flags that control whether the new ACE can be inherited by child objects.

BOOL AddAccessAllowedAceEx(
  PACL pAcl,            // pointer to an ACL
  DWORD dwAceRevision,  // ACL revision level
  DWORD AceFlags,       // ACE inheritance flags
  DWORD AccessMask,     // access mask for the new ACE
  PSID pSid             // SID of the trustee for the new ACE
);
 

Parameters

pAcl
Pointer to a DACL. The AddAccessAllowedAceEx function adds an access-allowed ACE to the end of this DACL. The ACE is in the form of an ACCESS_ALLOWED_ACE structure.
dwAceRevision
Specifies the revision level of the ACL being modified. This value can be ACL_REVISION or ACL_REVISION_DS. Use ACL_REVISION unless you are sure the ACL contains object-specific ACEs.
AceFlags
A set of bit flags that control ACE inheritance. The function sets these flags in the AceFlags member of the ACE_HEADER structure of the new ACE. This parameter can be a combination of the following values:
Value Meaning
CONTAINER_INHERIT_ACE
The ACE is inherited by container objects.
INHERIT_ONLY_ACE
The ACE does not apply to the object to which the ACL is assigned, but it can be inherited by child objects.
INHERITED_ACE
Indicates an inherited ACE. This flag allows operations that change the security on a tree of objects to modify inherited ACEs while not changing ACEs that were directly applied to the object.
NO_PROPAGATE_INHERIT_ACE
The OBJECT_INHERIT_ACE and CONTAINER_INHERIT_ACE bits are not propagated to an inherited ACE.
OBJECT_INHERIT_ACE
The ACE is inherited by noncontainer objects.

AccessMask
A set of bit flags that use the ACCESS_MASK format to specify the access rights that the new ACE grants to the specified SID. This mask must use the Windows NT access mask format, not the provider-independent access-mask format.
pSid
Pointer to a SID structure that identifies the user, group, or logon session to which the new ACE grants 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. If the AceFlags parameter specifies invalid flags, GetLastError returns ERROR_INVALID_FLAGS.

Remarks

The caller must ensure that ACEs are added to the DACL in the correct order. For more information, see Order of ACEs in a DACL.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in winbase.h.
  Import Library: Use advapi32.lib.

See Also

Low-Level Access-Control Overview, Low-Level Access Control Functions, ACCESS_ALLOWED_ACE, ACE_HEADER, ACL, AddAccessAllowedAce, AddAccessDeniedAceEx, AddAuditAccessAceEx