问题描述
谁能告诉我为什么我不能访问HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData的注册表项
?
Can anyone tell me why I can't access the registry key of "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData"
?
如果我查询 GetSubKeysNames
的HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft \Windows\CurrentVersion\Installer
它只返回一个值是安全
---->在哪里是所有其他子项?
if I query the GetSubKeysNames
of "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer"
it only returns one value being "Secure"
----> Where are all the other subkeys?
感谢。
推荐答案
高赔率正在运行的在Windows的64位版本的程序,它被强制为在32位模式下运行。注册表重定向器将让你真正阅读HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node的钥匙。是的,一个也有一个Microsoft\Windows\CurrentVersion\Installer关键,但它是相当空。使用Regedit.exe来比较。
High odds that you are running your program on the 64-bit version of Windows and it is forced to run in 32-bit mode. The registry redirector will make you actually read the keys in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node. And yes, that one also has a Microsoft\Windows\CurrentVersion\Installer key but it is pretty empty. Use Regedit.exe to compare.
最简单的解决方法是删除该强迫。项目+属性,构建选项卡,设置目标平台设置值为anycpu。如果你有VS2012和高达然后取消勾选首选32位选项。重复发布配置。如果你的必须的在32位模式下,你可以使用.NET 4+ RegistryKey.OpenBaseKey()方法,传递RegistryView.Registry64运行。
The simplest fix is to remove the forcing. Project + Properties, Build tab, set the Target platform setting to AnyCPU. If you have VS2012 and up then untick the "Prefer 32-bit" option. Repeat for the Release configuration. If you must run in 32-bit mode then you can use the .NET 4+ RegistryKey.OpenBaseKey() method, passing RegistryView.Registry64.
这篇关于访问HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!