private void Revert()
 {
     if (disposed || prev == null)
     {
         return;
     }
     lock (prev)
     {
         RuntimeHelpers.PrepareConstrainedRegions();
         hObj.AdjustPrivileges(prev);
     }
     disposed = true;
 }
 public PrivilegedCodeBlock(Process process, params SystemPrivilege[] systemPrivileges)
 {
     if (systemPrivileges == null || systemPrivileges.Length == 0)
     {
         return;
     }
     RuntimeHelpers.PrepareConstrainedRegions();
     hObj = SafeTokenHandle.FromProcess(process.Handle, TokenAccess.TOKEN_ADJUST_PRIVILEGES | TokenAccess.TOKEN_QUERY);
     if (systemPrivileges.Length == 1)
     {
         prev = hObj.AdjustPrivilege(systemPrivileges[0], PrivilegeAttributes.SE_PRIVILEGE_ENABLED);
     }
     else
     {
         prev = hObj.AdjustPrivileges(systemPrivileges.Select(p => new PrivilegeAndAttributes(p, PrivilegeAttributes.SE_PRIVILEGE_ENABLED)).ToArray());
     }
 }