コード例 #1
0
ファイル: Engine.cs プロジェクト: numerunix/UacControlPanel
        public Engine()
        {
            verificaSistema();
            chiave = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", true);
            int uac        = (int)chiave.GetValue("EnableLUA");
            int elevamento = (int)chiave.GetValue("ConsentPromptBehaviorAdmin", 2);

            statoUac        = (STATO_UAC)Enum.ToObject(typeof(STATO_UAC), uac);
            statoElevamento = (STATO_ELEVAMENTO)Enum.ToObject(typeof(STATO_ELEVAMENTO), elevamento);
        }
コード例 #2
0
ファイル: Engine.cs プロジェクト: numerunix/UacControlPanel
        public bool disabilitaUac()
        {
            bool riavvio = false;

            if (statoUac != STATO_UAC.DISABILITATO)
            {
                riavvio = true;
                chiave.SetValue("EnableLUA", 0);
                statoUac = STATO_UAC.DISABILITATO;
            }
            return(riavvio);
        }
コード例 #3
0
ファイル: Engine.cs プロジェクト: numerunix/UacControlPanel
        public bool abilitaUac(STATO_ELEVAMENTO e)
        {
            bool riavvio = false;

            if (statoUac != STATO_UAC.ABILITATO)
            {
                statoUac = STATO_UAC.ABILITATO;
                chiave.SetValue("EnableLUA", 1);
                riavvio = true;
            }
            statoElevamento = e;
            chiave.SetValue("ConsentPromptBehaviorAdmin", (int)e);
            return(riavvio);
        }