/// <summary> /// Convert an enumerable access rights to a string /// </summary> /// <param name="granted_access">The granted access mask.</param> /// <param name="generic_mapping">Generic mapping for object type.</param> /// <param name="enum_type">Enum type to convert to string.</param> /// <param name="map_to_generic">True to try and convert to generic rights where possible.</param> /// <returns>The string format of the access rights</returns> public static string GrantedAccessAsString(AccessMask granted_access, GenericMapping generic_mapping, Type enum_type, bool map_to_generic) { if (granted_access == 0) { return("None"); } AccessMask mapped_access = generic_mapping.MapMask(granted_access); if (map_to_generic) { mapped_access = generic_mapping.UnmapMask(mapped_access); } else if (generic_mapping.HasAll(granted_access)) { return("Full Access"); } return(NtObjectUtils.AccessRightsToString(enum_type, mapped_access)); }