从 32 位应用程序创建 64 位注册表项(非 WOW64) [英] Create 64 bit registry key (non-WOW64) from a 32 bit application
问题描述
我有一个正在创建一些注册表项的 Visual Studio 安装程序:
I have a Visual Studio installer that is creating some registry keys:
HKEY_LOCAL_MACHINESOFTWAREMyApp
但是它正在创建的注册表项会自动出现在 Wow6432Node 下:
but the registry keys it is creating are automatically appearing under Wow6432Node:
HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMyApp
在由 msi 执行的 C# 代码中创建注册表项时,如何忽略 Wow6432Node?p>
How do I ignore the Wow6432Node when creating registry keys in my C# code being executed by the msi?
推荐答案
仅供参考,.NET 4.0 本身就支持这一点.示例:
Just FYI, .NET 4.0 supports this natively. Example:
RegistryBase = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
然后您可以使用该 RegistryBase 变量访问 HKLM 64 位视图中的任何内容.相反,Registry32 将允许 64 位应用程序访问注册表的 32 位视图.
You can then use that RegistryBase variable to access anything in the 64-bit view of HKLM. Conversely, Registry32 will let a 64-bit application access the 32-bit view of the registry.
这篇关于从 32 位应用程序创建 64 位注册表项(非 WOW64)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!