registry - HKEY_LOCAL_MACHINE\SOFTWARE\Classes 与 HKEY_CLASSES_ROOT

标签 registry

在微软的 documentation ,我找到了下面这段

The HKEY_LOCAL_MACHINE\SOFTWARE\Classes key corresponds to the HKEY_CLASSES_ROOT key, which was retained for compatibility with earlier versions of COM.

现在,我不确定该段落中的 which 指的是哪个 key :HKLM\SOFTWARE\Classes 或 HKCU key 。

如果有人能澄清,我将不胜感激。

最佳答案

HKEY_CLASSES_ROOT(缩写。HKCR,不要与 HKCUHKEY_CURRENT_USER)是 HKLM 中 ...\Software\Classes 子层次结构的合并 View 香港中文大学。

这实际上是有记录的,尽管它没有从 COM docs 链接到。您引用:

HKEY_CLASSES_ROOT Key :

Class registration and file name extension information is stored under both the HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER keys. The HKEY_LOCAL_MACHINE\Software\Classes key contains default settings that can apply to all users on the local computer. The HKEY_CURRENT_USER\Software\Classes key contains settings that apply only to the interactive user. The HKEY_CLASSES_ROOT key provides a view of the registry that merges the information from these two sources. HKEY_CLASSES_ROOT also provides this merged view for applications designed for previous versions of Windows.

他们甚至进入 details of this merge mess ,但是如果您需要合并 View 中的任何特定行为,建议您验证它,因为在我看来,细节相当困惑:

  • 对于阅读来说,基本上大部分内容都是合并的,也就是说,您将看到两个键以及重叠键中的两个值。
  • 当两者的相同时,您很可能会看到来自 HKCU 的值,而不是来自 HKLM 的值。
  • 当两者都有相同/重叠的键时,您将看到其合并的值和子键。 (至少我是这么认为的。)(至少在 Win7 上是这样。)
  • 当您通过 HKCR 撰写时,这取决于您是否是管理员。以及是否在 UAC 下运行。 尽量不要通过 HKCR 写作,这会让你的生活更轻松。
    • 具体来说,我指的是this gem (这是你实际观察到的):

      If you write keys to a key under HKEY_CLASSES_ROOT, the system stores the information under HKEY_LOCAL_MACHINE\Software\Classes.

      If you write values to a key under HKEY_CLASSES_ROOT, and the key already exists under HKEY_CURRENT_USER\Software\Classes, the system will store the information there instead of under HKEY_LOCAL_MACHINE\Software\Classes.

关于registry - HKEY_LOCAL_MACHINE\SOFTWARE\Classes 与 HKEY_CLASSES_ROOT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53984433/

相关文章:

java - 如何从 Windows 注册表中获取 IE 版本号?

installation - WiX 在 Windows 7 安装期间不会添加 HKLM 注册表设置

assemblies - StructureMap 和扫描程序集

c++ - 如何从 32 位代码启动 64 位 Windows 进程?

com - COM TreatAs 如何(以及何时)起作用?

c# - 使用 C# .net 挂载其他用户配置单元

Windows 显示/隐藏隐藏文件/文件夹 - 单击一次 - 是否可以使用批处理文件 - 或单击一次?

C++ - RegCreateKeyEx 成功但没有结果

Python 不会从命令行中提取多个参数

c# - RegistryKey.OpenSubKey 抛出 SecurityException