/// <summary> /// Query the Auditing Security Descriptor. /// </summary> /// <param name="security_information">The security information to query.</param> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The security descriptor.</returns> public static NtResult <SecurityDescriptor> QuerySecurity(SecurityInformation security_information, bool throw_on_error) { if (!SecurityNativeMethods.AuditQuerySecurity(security_information, out SafeAuditBuffer buffer)) { return(NtObjectUtils.MapDosErrorToStatus().CreateResultFromError <SecurityDescriptor>(throw_on_error)); } using (buffer) { return(SecurityDescriptor.Parse(buffer, NtType, throw_on_error)); } }