Example #1
0
        public static object GetRegistryValue(RegistryKeyEx hive, string keyName, string valueName, RegistryViewEx view = RegistryViewEx.Default)
        {
            if (view == RegistryViewEx.Registry64 && !Is64BitOperatingSystem)
            {
                return(null);
            }

            RegistryKeyEx key2 = hive.OpenSubKey(keyName, view);

            if (key2 == null)
            {
                return(null);
            }

            object obj2;

            try
            {
                obj2 = key2.GetValue(valueName);
            }
            finally
            {
                key2.Close();
            }

            if (obj2 == null)
            {
                return(null);
            }

            return(obj2);
        }
Example #2
0
        public static object GetRegistryValue(string keyName, string valueName, RegistryViewEx view = RegistryViewEx.Default)
        {
            if (view == RegistryViewEx.Registry64 && !Is64BitOperatingSystem)
            {
                return(null);
            }

            string str;

            RegistryKeyEx key2 = GetBaseKeyFromKeyName(keyName, out str).OpenSubKey(str, view);

            if (key2 == null)
            {
                return(null);
            }

            object obj2;

            try
            {
                obj2 = key2.GetValue(valueName);
            }
            finally
            {
                key2.Close();
            }

            if (obj2 == null)
            {
                return(null);
            }

            return(obj2);
        }