共用方式為


AtlSetSacl

Call this function to set the system access-control list (SACL) information of a specified object.

inline bool AtlSetSacl(
   HANDLE hObject,
   SE_OBJECT_TYPE ObjectType,
   const CSacl& rSacl,
   DWORD dwInheritanceFlowControl = 0,
   bool bRequestNeededPrivileges = true
) throw(...);

Parameters

  • hObject
    Handle to the object for which to set security information.

  • ObjectType
    Specifies a value from the SE_OBJECT_TYPE enumeration that indicates the type of object identified by the hObject parameter.

  • rSacl
    The SACL containing the new security information.

  • dwInheritanceFlowControl
    The inheritance flow control. This value can be 0 (the default), PROTECTED_SACL_SECURITY_INFORMATION or UNPROTECTED_SACL_SECURITY_INFORMATION.

  • bRequestNeededPrivileges
    If true, the function will attempt to enable the SE_SECURITY_NAME privilege, and restore it on completion.

Return Value

Returns true on success, false on failure.

Remarks

In debug builds, an assertion error will occur if hObject is invalid, or if dwInheritanceFlowControl is not one of the three permitted values.

If AtlSetSacl is to be called many times on many different objects, it will be more efficient to enable the SE_SECURITY_NAME privilege once before calling the function, with bRequestNeededPrivileges set to false.

Requirements

Header: atlsecurity.h

See Also

Concepts

Security Global Functions

AtlGetSacl

CSacl Class