64 位 Windows 上的注册表重定向 [英] Registry redirection on 64-bit Windows
问题描述
我正在运行 64 位 Windows,我想使用 C# 创建注册表项 HKCUSoftwareClassesWow6432NodeCLSID{myguid}InprocServer32
.
I am running 64-bit Windows, and I want to create the registry key HKCUSoftwareClassesWow6432NodeCLSID{myguid}InprocServer32
using C#.
我应该告诉它写入哪个注册表项,以便将其重定向到上述项?这也应该适用于 32 位 Windows.
What registry key should I tell it to write, so that it will be redirected to the above key? This should also work on 32-bit Windows.
我正在编译我的应用程序以面向 x86.
I am compiling my app to target x86.
推荐答案
如果您使用 .net 4,您应该使用 RegistryView
枚举.当您调用 RegistryView.Registry32>OpenBaseKey
.使用 HKCUSoftwareClassesCLSID{myguid}InprocServer32
作为键,让重定向器完成工作.
If you are using .net 4 you should make use of the RegistryView
enumeration.
Pass RegistryView.Registry32
when you call OpenBaseKey
. Use HKCUSoftwareClassesCLSID{myguid}InprocServer32
as your key and let the redirector do the work.
如果您使用的是旧版本的 .net,那么恐怕您需要调用/调用本机 Win32 API.
If you are using an older version of .net then I am afraid you will need to p/invoke the native Win32 API.
如果您的目标是 x86,那么您无需执行任何操作.注册表重定向器会做正确的事情并将您的注册表访问重定向到注册表的 32 位视图.您只需要从 64 位进程中执行上述步骤.
If you happen to be targetting x86 then you don't need to do anything. The registry redirector will do the right thing and redirect your registry access to the 32 bit view of the registry. You only need to take the steps outline above from a 64 bit process.
这篇关于64 位 Windows 上的注册表重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!