Life and code.
RSS icon Email icon Home icon
  • Living 64-bit: Why Windows Thumbnails Show Up Randomly

    Posted on December 17th, 2009 Brian No comments

    Windows Explorer has had support for showing thumbnails instead of icons for many years now.  Support is built-in for many common formats, like images or rich text, but it doesn’t know how to deal with more complicated formats like PDFs and ODTs.  To compensate for this lack of support, there is an extension mechanism that third-party applications can use to teach Explorer how to render thumbnails. Then, whenever you create or modify a file, Explorer notices that it has changed, recreates the thumbnail, and saves it to a cache file.  This behavior is very evident if you save files on your desktop, since it is one Explorer window that is always visible.

    Unfortunately, in a 64-bit world, this approach often fails for the same reasons that Windows Search Filters often fail.  In 64-bit Windows, Explorer is a 64-bit process, but most third-party application programmers only provide 32-bit extension DLLs.  Since Explorer is unable to load the 32-bit DLLs, it cannot render the thumbnail – and you’re left with an ugly icon.  If you’re living 64-bit, though, you’ve no-doubt noticed that many of the thumbnails do get generated, but seemingly at random.  You might have a PDF sitting on your desktop for weeks, and suddenly one day it will switch from an ugly icon to a thumbnail.  What gives?

    The secret is that Explorer is not just a running process for viewing your files and folders.  It is exists in a series of libraries and common controls that third-party applications use to provide common functionality with a familiar interface.  For example, almost all “Save” and “Open” dialogs either use or extend the built-in Windows versions, and those Windows versions use the same libraries as Windows Explorer to hoist some of that familiar functionality into the applications.  In a very real sense, Explorer is being embedded in these third-party applications.

    But remember: These third-party applications are 32-bit.  That means that there are 32-bit versions of the Explorer libraries hanging around Windows, in case these applications need to use them.  So when a 32-bit application opens a “Save” dialog and you navigate to a folder, you’re essentially pointing a 32-bit version of Explorer at that folder.  Like usual, Explorer notices there are thumbnails that have not been generated, but now it can properly load the 32-bit third-party thumbnail extensions.  It renders the thumbnails and writes them out to the cache file.

    Surprise!  Thumbnails for a file you weren’t even working on have suddenly been updated.  It’s not random at all, but because you were working on a different file, it just seems random.