Registry redirection on 64-bit Windows

前端 未结 4 990
暗喜
暗喜 2021-01-20 16:47

I am running 64-bit Windows, and I want to create the registry key HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{myguid}\\InprocServer32 using C#.

What

4条回答
  •  再見小時候
    2021-01-20 17:15

    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.

    If you are using an older version of .net then I am afraid you will need to p/invoke the native Win32 API.

    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.

提交回复
热议问题