是否可以从 VS2010 部署项目手动写入 Wow6432Node 条目?
我有一个用 C# 编写的 .NET 组件,需要在 HKLM 配置单元下注册一些注册表值。我希望这个组件能够安装在运行适当版本 Windows 的 x86(32 位)和 x64(64 位)机器上。在 64 位系统上,我想确保该组件可以由 32 位和 64 位托管进程使用。我暂时坚持使用 Visual Studio 的部署项目。
我想要的是我的安装程序在 64 位系统上运行时,将其注册表项放在 HKLM/Software/Blablah
下,以便在 64 位进程中运行时,我的组件可以找到它的全局配置设置。但是,如果我的组件由在同一台计算机上运行的 32 位进程托管,那么它将读取它认为相同的密钥,但 Wow64 会将其转换为 HKLM/Software/Wow6432Node/Blablah。
是否可以编写我的 64 位安装程序,以便:
- 它被标记为 x64 安装程序
- 它会在
HKLM/Software/Blablah
下写入条目,以利于 64 位进程 - 它会写入以下内容的精确副本下的那些条目
HKLM/Software/Wow6432Node/Blablah
以获得同一台计算机上 32 位进程的优势。
我猜测,因为我已将安装程序标记为 x64,所以我将被迫专门为 32 位系统编写另一个单独的安装程序,该安装程序仅写入 HKLM/Software/Blablah
。
I have a .NET component written in C# that needs to register some registry values under the HKLM hive. I'm expecting this component to be installed on both x86 (32-bit) and x64 (64-bit) boxes running the appropriate flavour of Windows. On 64-bit systems, I want to make sure the component can be used by both 32- and 64-bit hosting processes. I'm stuck with using Visual Studio's deployment projects for the time being.
What I want is for my installer, when run on 64-bit systems, to put its registry entries under HKLM/Software/Blablah
, so that when running in a 64-bit process, my component can find its global configuration settings. However, if my component is hosted by a 32-bit process running on the same machine, then it will read from what it thinks is the same key, but which Wow64 will translate to HKLM/Software/Wow6432Node/Blablah.
Is it OK to author my 64-bit installer so that:
- it is marked as a x64 installer
- it writes the entries under
HKLM/Software/Blablah
for the benefit of 64-bit processes - it writes exact copies of those entries under
HKLM/Software/Wow6432Node/Blablah
for the benefit of 32-bit processes on the same machine.
I'm guessing that because I've marked the installer as x64, I will be forced to author another separate installer specifically for 32-bit systems, which only writes to HKLM/Software/Blablah
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常的做法是同时拥有 32 位和 64 位安装包。在 32 位计算机上,您只需运行 32 位软件包,在 64 位计算机上,您可以同时运行这两个软件包。
尝试自己处理所有注册表和文件重定向是一场噩梦,最好在 64 位计算机上安装 32 位软件包并让系统为您执行重定向。无论如何,您都必须为 32 位机器生成 32 位程序包,因此不需要额外的工作。
The normal practise is to have both 32 bit and 64 bit install packages. On the 32 bit machine you just run the 32 bit package, on the 64 bit machine you run both.
Trying to handle all the registry and file redirection yourself is a nightmare and it's much better to install a 32 bit package on a 64 bit machine and let the system do the redirection for you. You've got to produce the 32 bit package anyway for 32 bit machines, so it's no extra work.