Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error reading registry in 64 bit deployment

4 views
Skip to first unread message

Bobby C. Jones at dot com

unread,
Jan 12, 2010, 4:11:02 PM1/12/10
to
I have code in an installer class that runs as a custom action and searches
the registry. On 32 bit systems, it runs fine. On 64 bit systems, it runs
fine in the test units, but fails when run in the installer. It fails at:

RegistryKey key =
Regitstry.LocalMachine.OpenSubKey(@"Software\Autodesk\Revit\Autodesk Revit
Architecture 2010")

It returns null. I'm sure this is due to a fundamental misunderstanding on
my part. Could someone set me straight. Thanks.


private string GetSubKeyValue(string regPathKey, string subkeyName,
string valueName)
{
try
{
using (RegistryKey key =
Registry.LocalMachine.OpenSubKey(regPathKey)) //key is null
using (RegistryKey subKey = key.OpenSubKey(subkeyName))
{
string val = subKey.GetValue(valueName) as string;
if (val == null) { return string.Empty;}
else { return val; }
}
}
catch
{
return string.Empty;
}
}

--
Bobby C. Jones
http://bobbycjones.spaces.live.com

Bobby C. Jones at dot com

unread,
Jan 12, 2010, 4:13:50 PM1/12/10
to

Bobby C. Jones at dot com

unread,
Jan 13, 2010, 11:40:36 AM1/13/10
to
0 new messages