Registry.GetValue(String, String, Object) Method
Retrieves the value associated with the specified name, in the
specified registry key. If the name is not found in the specified key,
returns a default value that you provide, or null if the specified key
does not exist.
Returns
null
if the subkey specified by keyName
does not exist; otherwise, the
value associated with valueName
, or defaultValue
if valueName
is not
found.
However i think your problem is you are probably trying to read 64/32 bit registry hive from a 32/64 bit application
RegistryView Enumeration : On the 64-bit version of Windows, portions
of the registry are stored separately for 32-bit and 64-bit
applications. There is a 32-bit view for 32-bit applications and a
64-bit view for 64-bit applications.
You can specify a registry view when you use the OpenBaseKey and
OpenRemoteBaseKey(RegistryHive, String, RegistryView) methods, and the
FromHandle property on a RegistryKey object.
using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
{
using (var subKey = baseKey.OpenSubKey("blah", RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryRights.FullControl))
{
if (subKey != null)
{
var value = subKey.GetValue("Somekey");
}
}
}
64 bit Registry Key not updated by 32 bit application