Luca's
Luca's

Reputation: 373

Write the registry value without redirect in Wow6432Node

this code insert the registry value

Microsoft.Win32.RegistryKey key;
            key = Microsoft.Win32.Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Internet Explorer\\MAIN\\FeatureControl\\FEATURE_BROWSER_EMULATION"); 
            key.SetValue("MyBrowser.exe", 8000);
            textBox1.Text = key.GetValue("MyBrowser.exe").ToString(); 
            key.Close();

in windows 32 bit work, but in 64 bit is inserted to wow6432node how to disable the redirect?

Upvotes: 4

Views: 5977

Answers (2)

Hans Passant
Hans Passant

Reputation: 941585

RegistryView is available only on .NET 4. You might want to consider allowing your program to run as a 64-bit process so no redirection takes place. VS2010 has new behavior, it forces apps to run in 32-bit mode on new projects. Project + Properties, Build tab, change Platform target to AnyCPU.

Upvotes: 5

David Heffernan
David Heffernan

Reputation: 612993

You need to open the key using RegistryView.Registry64. You specify this in the OpenBaseKey method so you'll need to rejig your code a little.

Upvotes: 8

Related Questions