我想在下面的注册表路径中为“NoModify”设置一个值。“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\XXXX”
我正在使用下面的代码,它仅适用于 X86 机器。你能看出为什么这不适用于 x64 机器吗?
// This value is correct
RegistryView registryView = releaseFlags.Contains("PLATFORM_X86") ? RegistryView.Registry64 : RegistryView.Registry32;
using (RegistryKey hkeyLocalMachine = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, registryView))
{
RegistryKey noModifyKey = hkeyLocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{xxxx}", true); //SL: Key Name
if (noModifyKey != null)
{
noModifyKey.SetValue("NoModify", 0);
noModifyKey.Flush();
}
}