private static NtResult <AuditCategory> GetCategoryInternal(AuditPolicyEventType type, bool throw_on_error) { if (!SecurityNativeMethods.AuditLookupCategoryGuidFromCategoryId(type, out Guid category)) { return(NtObjectUtils.MapDosErrorToStatus().CreateResultFromError <AuditCategory>(throw_on_error)); } return(GetCategoryInternal(category, throw_on_error)); }
internal static extern bool AuditLookupCategoryGuidFromCategoryId( AuditPolicyEventType AuditCategoryId, out Guid pAuditCategoryGuid );
/// <summary> /// Get a single per-user category. /// </summary> /// <param name="user">The user SID to query.</param> /// <param name="type">The category type.</param> /// <returns>The audit category.</returns> public static AuditPerUserCategory GetPerUserCategory(Sid user, AuditPolicyEventType type) { return(GetPerUserCategoryInternal(user, type, true).Result); }
/// <summary> /// Get a single category. /// </summary> /// <param name="type">The category type.</param> /// <returns>The audit category.</returns> public static AuditCategory GetCategory(AuditPolicyEventType type) { return(GetCategoryInternal(type, true).Result); }