private SecurityDescriptor GetSecurityDescriptor(NtGeneric obj)
 {
     try
     {
         if (obj != null)
         {
             using (NtGeneric dup = obj.Duplicate(GenericAccessRights.ReadControl))
             {
                 return(dup.SecurityDescriptor);
             }
         }
     }
     catch
     {
     }
     return(null);
 }
Beispiel #2
0
 private SecurityDescriptor GetSecurityDescriptor(NtGeneric obj)
 {
     if (obj != null)
     {
         using (var dup = obj.Duplicate(GenericAccessRights.ReadControl, false)) {
             if (!dup.IsSuccess)
             {
                 return(null);
             }
             var sd = dup.Result.GetSecurityDescriptor(SecurityInformation.AllBasic, false);
             if (!sd.IsSuccess)
             {
                 return(null);
             }
             return(sd.Result);
         }
     }
     return(null);
 }