Why do non-folders in my shell namespace extension show up in the folder tree view?

Raymond Chen

A customer was having trouble with their shell namespace extension:

When we click the [+] button next to our shell namespace extension in the folder tree view, the tree view shows both files and folders, even though it’s supposed to show only folders. Our IShell­Folder::Get­Attributes­Of does return the correct values for SFGAO_FOLDER (including it for the folders and omitting it for the non-folders). What are we doing wrong?

The tree view enumerates the children of a folder by calling IShell­Folder::Enum­Objects and passing the SHCONTF_FOLDERS flag while omitting the SHCONTF_NONFOLDERS flag. This means that it is only interested in enumerating child folders. Child non-folders should be excluded from the enumeration. It so happens that the customer’s shell namespace extension was not respecting the SHCONTF_FOLDERS and SHCONTF_NONFOLDERS flags; it always enumerated all objects regardless of what the caller requested.

Fixing the enumerator fixed the problem.


Discussion is closed.

Feedback usabilla icon