AddAce

The AddAce function adds one or more ACEs to a specified ACL.

An ACE is an access-control entry. An ACL is an access-control list.

BOOL AddAce(
  PACL pAcl,             // pointer to access-control list
  DWORD dwAceRevision,   // ACL revision level
  DWORD dwStartingAceIndex,  // index of ACE position in ACL
  LPVOID pAceList,       // pointer to one or more ACEs
  DWORD nAceListLength   // size of buffer for ACEs
);
 

Parameters

pAcl
Pointer to an ACL structure. This function adds an ACE to this ACL.
dwAceRevision
Specifies the revision level of the ACL being modified. Currently, this value must be ACL_REVISION.
dwStartingAceIndex
Specifies the position in the ACL's list of ACEs at which to add new ACEs. A value of zero inserts the ACEs at the beginning of the list. A value of MAXDWORD appends the ACEs to the end of the list.
pAceList
Pointer to a list of one or more ACEs to be added to the specified ACL. The ACEs in the list must be stored contiguously.
nAceListLength
Specifies the size, in bytes, of the input buffer pointed to by the pAceList parameter.

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

Applications frequently use the FindFirstFreeAce and GetAce functions when using the AddAce function to manipulate an ACL. In addition, the ACL_SIZE_INFORMATION structure retrieved by the GetAclInformation function contains the size of the ACL and the number of ACEs it contains.

QuickInfo

  Windows NT: Requires version 3.1 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, ACL, ACL_SIZE_INFORMATION, AddAccessAllowedAce, AddAccessDeniedAce, AddAuditAccessAce, DeleteAce, FindFirstFreeAce, GetAce, GetAclInformation