Microsoft Windows Registry Guide, Second Edition
Specialized Keys
When Windows queries a file association, it checks the following keys in the order shown; that is, locations further down the list have a higher order of precedence than locations higher in the list:
- HKCR\progid.
This is the program class associated with the file extension key through the file extension key's default value.
- HKCR\SystemFileAssociations.
This key defines perceived file types and associates commands with each. See the “SystemFileAssociations” section that follows for more information.
- HKCR\*.
This is the base class for files of all types. You see the commands in this key on the shortcut menus of all files.
- HKCR\AllFileSystemObjects.
This key defines commands for all files and folders. By default, this key just adds the Send To item on shortcut menus.
The following sections describe some keys in the previous list as well as others that are useful for customizing Windows. Notably, the section “SystemFileAssociations” describes how to customize the commands you see on files perceived as a certain type. The section “Applications” describes how to customize the Open With dialog box and more.
Applications
To display an application in the Open With dialog box, that application must register in HKCR\Applications. Each subkey in Applications bears the name of the program file. For example, Notepad is in HKCR\Applications\Notepad.exe. You must also add the OpenWithList key to the file extension key, as described earlier in this appendix. You find combinations of the following values and subkeys in the program's subkeys:
- FriendlyAppName.
This REG_SZ value contains the application's friendly name. This value can contain a string, but it more likely contains a value in the format @file,- re source, where file is the name of the program file containing the string resource identified by resource.
- NoOpenWith.
This empty REG_SZ value indicates that Windows should not add the program to the Open With list.
- SupportedTypes.
This subkey contains a list of file extensions, including the leading period, which indicates which type of files the program can open. For example, HKCR\Applications\mplayer2.exe\SupportedTypes contains the empty REG_SZ values .asf and .mp3, indicating that the program can open files that have these file extensions. This list filters the Open With list.
SystemFileAssociations
The key HKCR\SystemFileAssociations is a cool way to customize the shortcut menus of files by their perceived purposes. For example, you can customize the verbs you see for all files you perceive as text files or all files you perceive as image files.
HKCR\SystemFileAssociations contains subkeys for the different perceived types you can set in the value PerceivedType. You learned about this value in the “PerceivedType” section earlier in this appendix. Thus, setting Pe rceivedType in a file extension key associates that file name extension with the commands in this key. For example, if you set the value PerceivedType in HKCR\.inf to text, you'll see the commands in HKCR\SystemFileAssociations\text on the shortcut menu of any file that has the .inf extension. Perceived types in SystemFileAssociations include audio, image, system, text, and video. You can add additional perceived types to SystemFileAssociations, though. The organization of HKCR\SystemFileAssociations\type is the same as program classes, which you learned about in the “Program Class Keys” section earlier in this appendix.
Unknown
When users try opening files that have an extension not registered in HKCR, Windows looks in HKCR\Unknown. By default, the only verb in Unknown\Shell is Open As. Windows displays the Open With dialog box for unknown types of files.