Remove the "Include in library" item from the menu that returns IContextMenu::QueryContextMenu
See the question and my original answer on StackOverflowMost of the Windows Shell registry calls test HKEY_CURRENT_USER
before going to HKEY_LOCAL_MACHINE
.
And when they access the Software\Classes
sub key, the usually do it through the HKEY_CLASSES_ROOT root key which is a merged view or both HKCU and HKLM.
So in this case, we can use the HKEY_CURRENT_USER\Software\Classes\Folder\ShellEx\ContextMenuHandlers\Library Location
key and put something invalid for the Shell in the default value. This value should not be a CLSID, or if it is, it should be a CLSID that doesn't match any real COM object's CLSID, like a random guid for example.