I want to write to this registry
SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run
I tried this:
RegistryKey registryKey64 = RegistryKey
.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)
.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run");
registryKey64.SetValue("CTIPopupForIPPhone", Application.ExecutablePath);
and I got this exception:
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
Additional information: Cannot write to the registry key.
though I am running my Visual Studio as an administrator.
Update
During the development, I also tried
RegistryKey registryKey = Registry.CurrentUser
.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run", true);
but I got error that the entry doesn't exist though it is there, but I thought that because the RegistryKey
is for Windows 32-bit not 64-bit.