C++ Windows Shell thumbnail handler (CppShellExtThumbnailHandler)

The code sample demonstrates the VC++ implementation of a Windows Shell preview handler for a new file type registered with the .recipe extension.

C++ (117.3 KB)
 
 
 
 
 
4.5 Star
(2)
13,668 times
Add to favorites
1/16/2012
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • use-after-free bug
    1 Posts | Last post April 25, 2016
    • In Reg.cpp (line 278), 'szDefaultVal' is copied via 'StringCchPrintf()' through the 'pszFileType' pointer set in line 272 even though it is already out-of-scope. This accidentally works with Visual C++, but it's obviously illegal and might break with other compilers.
      
      I know it's "just an example" but with 12.000 downloads, some people will copy the illegal code carelessly.
      
      Another questionable line is Reg.cpp (63): MSDN clearly states on 'RegSetValueEx()': "[cbData] must include the size of the terminating null character or characters", but here it doesn't.
  • Can I register more than 1 custom filetype using this code?
    1 Posts | Last post June 06, 2015
    • Hello and thank you for sharing this code sample with us.
      I ve managed to register my own custom file and everything works perfect, but it seems that when I try to register a 2nd custom filetype, it cancels the registration of the 1st one. Does this makes sense or I am missing something?
      Thank you.
  • Example seems not to work in Windows 8, Is there any diference to be compensated for it to work?
    1 Posts | Last post June 09, 2012
    • I have compiled and registered the resulting dll and even after restarting I get no thumbnail for the sample file no matter what visualization mode I'm at. I even tryed to empty the thumbnail cache with a clening tool (CCleaner) but is was of no use.
      I've tested the extensior under Windows 7 and worked great, I even adapted  it(changed: file extension it looks for, extension registry guid, tag scrapped for the image data) for my own use with another xml based format I generate from an app I'm developing and even the adapted version worked perfectly. 
      Now I've tryed the adapted version under Windows 8 Release Preview and it seems to keep the files it's extracting the thumbnail open, I cannot delete or overwrite them for explorer, only from command prompt using "del". It still extract the thumbnails properly but that's that.
      The original example seem not to work at all, it doesn't lock the file away but does not extract the thumbnail either.
      If it helps I'd be happy to provide the adapted code for test.
      Thanks for any help in advance...