How do I prevent folder verbs intended for file system directories from showing up in my shell extension’s virtual folder’s context menu?

Raymond Chen

A customer was developing a shell namespace extension, and for virtual folder context menus, they create the menu with ASSOCCLASS_FOLDER. However, they found that when the user right-clicked on their virtual folders, the resulting context menu contained commands for file system folders such as “Scan with Fabrikam Malware Protection” and “Encrypt with Contoso”. Was ASSOCCLASS_FOLDER correct? If not, what’s the correct flag to use to block these file system commands?

The ASSOCCLASS_FOLDER value is correct.

What’s incorrect is everybody else.

Some time ago, I briefly discussed the difference between the Folder and Directory progids. Folder refers to any shell folder, both file system and virtual. Directory refers specifically to file system folders.

What’s probably happening is that the Fabrikam and Contoso shell extensions erroneously registered themselves under Folder (“I support all folders, even the virtual ones!”) rather than under Directory (“I support file system folders.”) If you click around other virtual folders in the system,¹ you’ll probably see Fabrikam and Contoso cheerfully offering their services to such oddball places as the legacy Storage Spaces control panel.

So yeah, those guys appear on your virtual folder context menu because they asked to appear on all folder context menus, both file system and virtual. Their bug is causing you to suffer. This is the sort of thing Windows has to put up with all the time, so at least you’re in good company.

¹ Virtual folders are gradually disappearing from the default experience, and finding one on a clean system is getting harder. One place that still has them is the legacy Control Panel: Go into View by: Large Icons, and then you can right-click the icons to see the context menus. Some of those icons represent items (the ones that run a separate app), and some of them represent folders (the ones that navigate to a new window inside Control Panel).

0 comments

Discussion is closed.

Feedback usabilla icon