예제 #1
0
        private static void SetProcessPermissions(IntPtr rawHandle, bool allowTermination)
        {
            ProcessAccessRights noAccess           = ProcessAccessRights.Terminate | ProcessAccessRights.SuspendResume;
            SafeHandle          handle             = new SafeHandleWrapper(rawHandle);
            ProcessSecurity     sec                = new ProcessSecurity(handle);
            ProcessAccessRule   noTerminateSuspend = new ProcessAccessRule(Everyone, noAccess,
                                                                           false, InheritanceFlags.None,
                                                                           PropagationFlags.NoPropagateInherit,
                                                                           (AccessControlType)Convert.ToInt32(!allowTermination));

            sec.AddAccessRule(noTerminateSuspend);
            sec.SaveChanges(handle);
        }
예제 #2
0
 public void AddAccessRule(ProcessAccessRule rule)
 {
     base.AddAccessRule(rule);
 }