This line works:
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(
baseKeyName + subKey, RegistryKeyPermissionCheck.ReadWriteSubTree);
While these lines produce a SecurityException - Requested registry access is not allowed on the OpenSubKey
line:
RegistryKey baseKey = RegistryKey.OpenBaseKey(
RegistryHive.LocalMachine, RegistryView.Registry32);
RegistryKey registryKey = baseKey.OpenSubKey(
baseKeyName + subKey, RegistryKeyPermissionCheck.ReadWriteSubTree);
On the same Win7 machine.
I'm doing it this way because in the 'real' code there is a conditional that will use the the Registry64 RegistryView on 64 bit machines.
Anyone got any ideas or workarounds?