Share via


AtlGetSecurityDescriptor

Call this function to retrieve the security descriptor of a given object.

inline bool AtlGetSecurityDescriptor(
   LPCTSTR pszObjectName,
   SE_OBJECT_TYPE ObjectType,
   CSecurityDesc * pSecurityDescriptor,
   SECURITY_INFORMATION requestedInfo = OWNER_SECURITY_INFORMATION | 
      GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | 
      SACL_SECURITY_INFORMATION,
   bool bRequestNeededPrivileges = true
) throw(...);

Parameters

  • pszObjectName
    Pointer to a null-terminated string that specifies the name of the object from which to retrieve security information.

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

  • pSecurityDescriptor
    The object which receives the requested security descriptor.

  • requestedInfo
    A set of SECURITY_INFORMATION bit flags that indicate the type of security information to retrieve. This parameter can be a combination of the following values.

  • 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

If AtlGetSecurityDescriptor 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

Other Resources

Security Global Functions