I need to write a thumbnail handler for all the files under a given folder. This folder is a mounting point for a virtual file system (using Callback File System), and the f
I see two ways for you to go.
The simple way: Register your own thumbnail handler and let it work on all files. When you don't support IInitializeWithStream but only IInitializeWithItem or IInitializeWithFile you can check if the item/file is in your virtual file system. If so you can return a thumbnail and otherwise return an error.
The problem with this approach is that only one thumbnail provider can be registered per file type.
The hard way: You can write a shell namespace extension. These can be used to display virtual folders, which can be customized in many ways. This is another way to do what you already did using cbfs, but it is restricted to Explorer only. It would add another way to display your virtual folders.
The shell namespace extension will only work for it's own virtual folder. If you mapped your virtual folders to a drive letter and the user opens that drive in Explorer (and not the shell namespace extension's virtual folder), the user would see regular Explorer view of the files, not your shell namespace extension.
Also: Documentation for shell namespace extensions is a pain, there is not much available. I wrote my own shell namespace extension and every time my objects where queried for an IID I traced that and learned a bit more. I saw that my extension is queried for IID_IThumbnailHandlerFactory, I also saw IIDs like IID_IExtractIconA or IID_IContextMenu, but I did not see IID_IThumbnailProvider, nor did I see IID_IExtractImage. This suggests that you cannot have your own IThumbnailProvider directly attached to the objects you create for the virtual folder, but it could also be that I just missed to set some flag somewhere else so that Explorer does not even try to query me.