Wednesday, October 17, 2007

HKEY_CLASSES_ROOT (HKCR) key description

imageHere is a tip. Avoid writing, deleting or merging (like .REG files or using regedit.exe) to HKEY_CLASSES_ROOT.

Why?

Basically because HKCR is a merged view based on HKEY_LOCAL_MACHINE\Software\Classes and HKEY_CURRENT_USER\Software\Classes and it can be confusing as to if this will work for the current user, a new user, the administrator user or so.

The registry system uses the following rules to merge information from the two sources:

  • The merged view includes all subkeys of the HKEY_CURRENT_USER\Software\Classes key.
  • The merged view includes all immediate subkeys of the HKEY_LOCAL_MACHINE\Software\Classes key that do not duplicate the subkeys of HKEY_CURRENT_USER\Software\Classes.
  • Below is a list of subkeys that are found in both HKEY_LOCAL_MACHINE\Software\Classes and HKEY_CURRENT_USER\Software\Classes. The immediate subkeys of these keys from the HKEY_LOCAL_MACHINE tree are included in the merged view only if they are not duplicates of immediate subkeys from the HKEY_CURRENT_USER tree. The merged view does not include the HKEY_LOCAL_MACHINE contents of duplicate subkeys.

The following subkeys are found in both HKEY_LOCAL_MACHINE\Software\Classes and HKEY_CURRENT_USER\Software\Classes. From the HKEY_LOCAL_MACHINE tree, the immediate subkeys of these keys are included in the merged view only if they are not duplicates of immediate subkeys from the HKEY_CURRENT_USER tree. The merged view does not include the HKEY_LOCAL_MACHINE contents of duplicate subkeys.

*
*\shellex
*\shellex\ContextMenuHandlers
*\shellex\PropertySheetHandlers
AppID
ClsID
Component Categories
Drive
Drive\shellex
Drive\shellex\ContextMenuHandlers
Drive\shellex\PropertySheetHandlers
FileType
Folder
Folder\shellex
Folder\shellex\ColumnHandler
Folder\shellex\ContextMenuHandlers
Folder\shellex\ExtShellFolderViews
Folder\shellex\PropertySheetHandlers
Installer\Components
Installer\Features
Installer\Products
Interface
Mime
Mime\Database
Mime\Database\Charset
Mime\Database\Codepage
Mime\Database\Content Type
Typelib

The HKCR key contains file extension associations and COM class registration information such as ProgIDs, CLSIDs, and IIDs.

More is found in this MSDN document.

No comments:

Post a Comment