I have a Silverlight 4 application in which I can read existing registry values from the HKLM branch with no problem but if I add new value the Read fails with a FileNotFoundException. You can see in the code below; the first read works fine but the second one fails to read the Test value that I added in the registry.
NOTE: I am able to read the newly added key under Windows XP; just not under Windows 7.
Any help would be greatly appreciated.
if (Application.Current.InstallState == InstallState.Installed && Application.Current.HasElevatedPermissio开发者_如何学Pythonns)
{
    if (AutomationFactory.IsAvailable)
    {
        dynamic shell = AutomationFactory.CreateObject("WScript.shell");
        try
        {
            var resa = shell.RegRead(@"HKLM\SOFTWARE\Microsoft\.NETFramework\InstallRoot");
            var resb = shell.RegRead(@"HKLM\SOFTWARE\Microsoft\.NETFramework\Test");
            var regValue = shell.RegRead(DbTypeRegKeyName);
            var dbType = ExtractDbTypeFromId(regValue);
        }
        catch (FileNotFoundException fileNotFoundException)
        {
            throw new Exception(string.Format("Failed to read registry value '{0}' with error '{1}'.", DbTypeValueName, fileNotFoundException));
        }
    }
}
Worked okay under 32 bit version of Windows. Turns out the 64 bit version of Windows has a different view of the registry. Adding my key under the Wow6432Node key in the registry solved the problem.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论