I know there are lots of sites about this. I've been testing out different ideas for about 6 hours now. I'm trying to get a 32bit app to modify the 64bit registry. I need to set the permissions to HKLM\Software\Microsoft\Windows\Current Version\Installer\UserData\ If you are wondering why, it's because our software throws an error if the permissions aren't correct.
Here is what I'm trying
static bool SetRegistryPermissions(string hkLmKey, string userAccount)
{
//this will force the app to see the 64bit registry instead of being redirected
RegistryKey localMachineX64View = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
RegistryKey rk = localMachineX64View.OpenSubKey(hkLmKey, true);
//This redirects to the Wow6432Node in the registry
//RegistryKey rk = Registry.LocalMachine.OpenSubKey(hkLmKey, true);
The program was working fine on a test key in WoW6432Node prior to changing the key to localMachineX64. Now I get a security exception when debugging on the OpenSubKey.
Any advice is welcome and Thanks for your time.
P.S. Any suggestions for books that contain good info writing NT permissions in C# would be a bonus.