/// <summary> /// Set the global SACL. /// </summary> /// <param name="type">The global SACL type.</param> /// <param name="security_descriptor">The SACL to set in an Security Descriptor.</param> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The NT status code.</returns> public static NtStatus SetGlobalSacl(AuditGlobalSaclType type, SecurityDescriptor security_descriptor, bool throw_on_error) { if (!security_descriptor.SaclPresent) { throw new ArgumentException("Must specify a SACL."); } using (var buffer = security_descriptor.Sacl.ToSafeBuffer()) { if (!SecurityNativeMethods.AuditSetGlobalSacl(type.ToString(), buffer)) { return(NtObjectUtils.MapDosErrorToStatus().ToNtException(throw_on_error)); } return(NtStatus.STATUS_SUCCESS); } }