Example #1
0
        ////////////////////////////////////////////////////////////////////////////////
        // Disable and remove all the privileges on a given token
        ////////////////////////////////////////////////////////////////////////////////
        private static void _NukePrivileges(CommandLineParsing cLP, IntPtr hToken)
        {
            using (TokenManipulation t = new TokenManipulation(hToken))
            {
                if (cLP.Remote)
                {
                    t.SetWorkingTokenToRemote();
                    if (!t.OpenProcessToken(cLP.ProcessID))
                    {
                        return;
                    }
                }
                else
                {
                    t.SetWorkingTokenToSelf();
                }

                t.DisableAndRemoveAllTokenPrivileges();
            }
        }