Exemplo n.º 1
0
        private bool GetIsUacEnabled()
        {
            using (RegistryKey localMachineKey = RegistryUtil.GetRegistryHiveOnBit(RegistryHive.LocalMachine))
            {
                using (RegistryKey systemKey = localMachineKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"))
                {
                    if (systemKey != null)
                    {
                        try
                        {
                            int value = int.Parse(systemKey.GetValue("EnableLUA").ToString());

                            return(value > 0);
                        }
                        catch
                        {
                            // Could not read value
                        }
                    }
                }
            }

            return(true);
        }