The Context handler is registered on the ProgID for the extension. This may be the entry under HKEY_CLASSES_ROOT itself, but often this entry will defer to another ProgID, in which case the context handler needs to be registered there. An example is the .cs file extension. Here is its registration under HKEY_CLASSES_ROOT when Visual Studio is installed:
And here is the referenced ProgID with context menu handler registered:
Again, the GUID is that of our registered Context handler service.
It turns out that Windows Explorer does not always pickup this registry entry, so we also place the same information in a lower priority location, as backup:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.cs] "Content Type"="text/plain" "PerceivedType"="text" @="VisualStudio.cs.10.0"
And here is the referenced ProgID with context menu handler registered:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\VisualStudio.cs.10.0] "AlwaysShowExt"="1" @="Visual C# Source file" [HKEY_CLASSES_ROOT\VisualStudio.cs.10.0\ShellEx] [HKEY_CLASSES_ROOT\VisualStudio.cs.10.0\ShellEx\ContextMenuHandlers] [HKEY_CLASSES_ROOT\VisualStudio.cs.10.0\ShellEx\ContextMenuHandlers\AlternateStreamMetadata] @="{28D14D00-2D80-4956-9657-9D50C8BB47A5}"
Again, the GUID is that of our registered Context handler service.
It turns out that Windows Explorer does not always pickup this registry entry, so we also place the same information in a lower priority location, as backup:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\SystemFileAssociations\.cs] [HKEY_CLASSES_ROOT\SystemFileAssociations\.cs\ShellEx] [HKEY_CLASSES_ROOT\SystemFileAssociations\.cs\ShellEx\ContextMenuHandlers] [HKEY_CLASSES_ROOT\SystemFileAssociations\.cs\ShellEx\ContextMenuHandlers\AlternateStreamMetadata] @="{28D14D00-2D80-4956-9657-9D50C8BB47A5}"