64位Windows上的注册表重定向 [英] Registry redirection on 64-bit Windows

查看:381
本文介绍了64位Windows上的注册表重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行64位Windows,并且要创建注册表项 HKCU\软件\类\Wow6432Node\CLSID\ {myguid} \InprocServer32 使用C#。

I am running 64-bit Windows, and I want to create the registry key HKCU\Software\Classes\Wow6432Node\CLSID\{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.aspx rel = noreferrer> OpenBaseKey 。使用 HKCU\软件\类\CLSID {myguid} \InprocServer32 作为密钥,并让重定向器完成工作。

If you are using .net 4 you should make use of the RegistryView enumeration. Pass RegistryView.Registry32 when you call OpenBaseKey. Use HKCU\Software\Classes\CLSID{myguid}\InprocServer32 as your key and let the redirector do the work.

如果您使用的是旧版本的.net,那么恐怕您将需要p /调用本机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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆