Ejemplo n.º 1
0
        public static void Exit(ShutdownFlags Flags = ShutdownFlags.Shutdown, int Reason = 0)
        {
            var tp = new TokPriv1Luid(1, 0, AdvApi32.SE_PRIVILEGE_ENABLED);
            IntPtr hproc = Kernel32.CurrentProcess, htok = IntPtr.Zero;

            AdvApi32.OpenProcessToken(hproc, AdvApi32.TOKEN_ADJUST_PRIVILEGES | AdvApi32.TOKEN_QUERY, ref htok);
            AdvApi32.LookupPrivilegeValue(null, "SeShutdownPrivilege", ref tp.Luid);
            AdvApi32.AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);

            User32.ExitWindows(Flags, 0);
        }
Ejemplo n.º 2
0
 public static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall, ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen);
Ejemplo n.º 3
0
 public static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall, ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen);