AuditQuerySecurity function (ntsecapi.h)

The AuditQuerySecurity function retrieves security descriptor that delegates access to audit policy.


BOOLEAN AuditQuerySecurity(
  [in]  SECURITY_INFORMATION SecurityInformation,
  [out] PSECURITY_DESCRIPTOR *ppSecurityDescriptor


[in] SecurityInformation

A SECURITY_INFORMATION value that specifies which parts of the security descriptor this function sets. Only SACL_SECURITY_INFORMATION and DACL_SECURITY_INFORMATION are supported. Any other values are ignored. If neither SACL_SECURITY_INFORMATION nor DACL_SECURITY_INFORMATION is specified, this function fails and returns ERROR_INVALID_PARAMETER.

[out] ppSecurityDescriptor

The address of a pointer to a well-formed SECURITY_DESCRIPTOR structure that controls access to the Audit security object.

Return value

If the function succeeds, it returns TRUE.

If the function fails, it returns FALSE. To get extended error information, call GetLastError. GetLastError may return one of the following error codes defined in WinError.h.

Return code/value Description
The caller does not have the privilege or access rights necessary to call this function.
One or more parameters are invalid.


To successfully call this function, the caller must have SeSecurityPrivilege.


Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header ntsecapi.h
Library Advapi32.lib
DLL Advapi32.dll

See also