예제 #1
0
        /// <summary>
        /// Get a security descriptor from a named object.
        /// </summary>
        /// <param name="name">The path to the resource (such as \BaseNamedObejct\ABC)</param>
        /// <param name="type">The type of resource, can be null to get the method to try and discover the correct type.</param>
        /// <returns>The named resource security descriptor.</returns>
        /// <exception cref="NtException">Thrown if an error occurred opening the object.</exception>
        /// <exception cref="ArgumentException">Thrown if type of resource couldn't be found.</exception>
        public static SecurityDescriptor FromNamedObject(string name, string type)
        {
            try
            {
                using (NtObject obj = NtObject.OpenWithType(type, name, null, GenericAccessRights.ReadControl))
                {
                    return(obj.SecurityDescriptor);
                }
            }
            catch
            {
            }

            return(null);
        }
 public NtObject Open(AccessMask access)
 {
     return(NtObject.OpenWithType(NtTypeName, Name, _root, access));
 }
 public NtObject Open(GenericAccessRights access)
 {
     return(NtObject.OpenWithType(TypeName, Name, _root, access));
 }