我的.NET应用程序(任何-CPU)需要读取由32位程序创建的注册表值。在64位的Windows这正好下在注册表中的Wow6432Node关键。我已阅读,你不应该硬code到Wow6432Node,所以什么是正确的方式来使用.NET访问它?
My .NET application (any-CPU) needs to read a registry value created by a 32-bit program. On 64-bit Windows this goes under the Wow6432Node key in the registry. I have read that you shouldn't hard-code to the Wow6432Node, so what's the right way to access it with .NET?
在那里你明确需要读取写的32位程序的值在64位程序的情况下,它的确定到c很难$ C $。很简单,因为实在是没有其他选择。
In the case where you explicitly need to read a value written by a 32 bit program in a 64 bit program, it's OK to hard code it. Simply because there really is no other option.
我当然会抽象出来给一个辅助功能。例如
I would of course abstract it out to a helper function. For example
public RegistryKey GetSoftwareRoot() {
var path = 8 == IntPtr.Size
? @"SoftwareWow6432Node"
: @"Software";
return Registry.CurrentUser.OpenSubKey(path);
}
上一篇:我想间谍+ +,但我不会有Visual Studio我想、会有、我不、间谍
下一篇:究竟怎样的"特定版本"在Visual Studio中集引用的工作性质?中集、性质、版本、工作