读取注册表和 Wow6432Node 键 [英] Reading the registry and Wow6432Node key
问题描述
我有一些代码可以读取注册表并在 HKEY_LOCAL_MACHINESoftwareApp
中查找值,但是在 64 位版本的 Windows 上运行时,该值位于 HKEY_LOCAL_MACHINESoftwareWow6432NodeApp
.
I have some code that reads the registry and looks for a value in HKEY_LOCAL_MACHINESoftwareApp
but when running on 64-bit versions of Windows the value is under HKEY_LOCAL_MACHINESoftwareWow6432NodeApp
.
我应该如何最好地解决这个问题?我是否需要 64 位安装程序,还是应该重写代码以检测两个位置?
How should I best approach this? Do I need a 64-bit installer or should I rewrite my code to detect both places?
推荐答案
如果您将 C# 程序标记为 x86(而不是任何 CPU),那么它将看到 HKEY_LOCAL_MACHINESoftwareWow6432NodeApp
为HKEY_LOCAL_MACHINESoftwareApp
.
If you mark you C# program as x86 (and not Any CPU) then it will see HKEY_LOCAL_MACHINESoftwareWow6432NodeApp
as HKEY_LOCAL_MACHINESoftwareApp
.
如果安装了 64 位 .NET,则适用于任何 CPU 的 .NET 程序将作为 64 位进程运行.32 位注册表位于 Wow6432Node
下,用于 64 位程序.
A .NET program for Any CPU will run as a 64-bit process if 64-bit .NET is installed. The 32-bit registry is under the Wow6432Node
for 64-bit programs.
这篇关于读取注册表和 Wow6432Node 键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!