有人可以为我解释这个奇怪的结果吗?
在linqPad中获得以下代码
Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft").Dump();
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"Software\Microsoft").Dump();
查看进程监视器时,它看起来像这样:
RegQueryKey HKU\S-1-5-21-...
RegOpenKey HKU\S-1-5-21-...\Software\Microsoft
RegSetInfoKey HKU\S-1-5-21-...\Software\Microsoft
RegQueryKey HKU\S-1-5-21-...\Software\Microsoft
RegQueryKey HKU\S-1-5-21-...\Software\Microsoft
RegQueryKey HKLM
RegOpenKey HKLM\Software\Wow6432Node\Microsoft
RegSetInfoKey HKLM\SOFTWARE\Wow6432Node\Microsoft
RegQueryKey HKLM\SOFTWARE\Wow6432Node\Microsoft
RegQueryKey HKLM\SOFTWARE\Wow6432Node\Microsoft
我的问题是:
为什么Registry.CurrentUser访问64位和Registry.LocalMachine 32位?
(还有,为什么Registry.CurrentUser访问HKU\S-..
而不是HKCU
)
使用Windows 7,64位,.Net 3.5,LINQPad.exe *32
答案 0 :(得分:2)
如果您查看MSDN documentation,它表示HKCU \ Software \ Classes通过WOW64重定向重定向,但不是整个HKCU \ Software密钥。
HKEY_CURRENT_USER Shared Shared
SOFTWARE Shared Shared
Classes Shared Redirected and reflected
Appid Shared Redirected and reflected with one exception: the DllSurrogate and DllSurrogateExecutable registry values are not reflected if their value is an empty string.
CLSID Redirected Redirected and reflected
DirectShow Redirected Redirected and reflected
Interface Redirected Redirected and reflected
Media Type Redirected Redirected and reflected
MediaFoundation Redirected Redirected and reflected