I wrote a new thumbnail handler for windows 10. When I apply it on my custom ".mic" files (which are renamed ".jpg" files) the handler works well. However, for some reason the handler is not being called at all for ".jpg" files.
These are the entries I add to the registry during "DllRegisterServer":
// List of registry entries we want to create
const REGISTRY_ENTRY rgRegistryEntries[] =
{
{ HKEY_LOCAL_MACHINE, L"Software\\Classes\\CLSID\\" SZ_CLSID_MYTHUMBHANDLER, REG_SZ, NULL, SZ_XDRVTHUMBHANDLER },
{ HKEY_LOCAL_MACHINE, L"Software\\Classes\\CLSID\\" SZ_CLSID_MYTHUMBHANDLER L"\\InProcServer32", REG_SZ, NULL, szModuleName },
{ HKEY_LOCAL_MACHINE, L"Software\\Classes\\CLSID\\" SZ_CLSID_MYTHUMBHANDLER L"\\InProcServer32", REG_SZ, L"ThreadingModel", L"Apartment" },
{ HKEY_LOCAL_MACHINE, L"Software\\Classes\\.mic\\ShellEx\\{e357fccd-a995-4576-b01f-234630154e96}" , REG_SZ, NULL, SZ_CLSID_MYTHUMBHANDLER },
{ HKEY_LOCAL_MACHINE, L"Software\\Classes\\.jpg\\ShellEx\\{e357fccd-a995-4576-b01f-234630154e96}" , REG_SZ, NULL, SZ_CLSID_MYTHUMBHANDLER },
};
hr = S_OK;
for (int i = 0; i < ARRAYSIZE(rgRegistryEntries) && SUCCEEDED(hr); i++)
{
hr = CreateRegKeyAndSetValue(&rgRegistryEntries[i]);
}
When I tried testing my handler with the "ThumbnailProvider.exe" utility (provided with windows SDK), it works well. I ran the utility with a ".jpg" file, and my handler was successfully called.
Why is my handler not being called by explorer?
EDIT:
On some other PC, it seems to work perfectly. My original registration code works well and my handler is being called for "jpg" files. Both PCs have windows 10, and in fact they are VMs using the same base image.
EDIT:
I noticed that my handler is being called for some ".jpg" files, on others it doesn't. I may be wrong here, but the major difference that I have noticed between the files is the "Resolution Unit" property. For the working files there was no value for this property, for the non-working files, the value for this property is "2". I get the same behavior on all my PCs.
Any idea how this property affects the thumbnail handler being called? If it is not the "Resolution Unit" property, what can be the difference which causes it?
I think I found the reason why my thumbnail handler is not being called on some of the ".jpg" files. It seems that some jpg images have an embedded thumbnail inside them. So for these files no thumbnail handler is being called at all.
I used exiftool
utility to read the image properties, in the output I see the following lines:
Photoshop Thumbnail : (Binary data 8015 bytes, use -b option to extract)
Thumbnail Image : (Binary data 8015 bytes, use -b option to extract)
I used exiftool
to remove the thumbnails from the file. Once I did that, my handler was successfully called for this image.