在微软的 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
,不要与 HKC
U
、HKEY_CURRENT_USER
)是 HKLM 中 ...\Software\Classes
子层次结构的合并 View 和香港中文大学。
这实际上是有记录的,尽管它没有从 COM docs 链接到。您引用:
Class registration and file name extension information is stored under both the
HKEY_LOCAL_MACHINE
andHKEY_CURRENT_USER
keys. TheHKEY_LOCAL_MACHINE\Software\Classes
key contains default settings that can apply to all users on the local computer. TheHKEY_CURRENT_USER\Software\Classes
key contains settings that apply only to the interactive user. TheHKEY_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.
- 具体来说,我指的是this gem (这是你实际观察到的):
关于registry - HKEY_LOCAL_MACHINE\SOFTWARE\Classes 与 HKEY_CLASSES_ROOT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53984433/