RSRC Loader

The unfortunate thing about loading Windows icons is that they aren’t usually stored as icons, they are usually stored inside Windows binaries and extracted using the Win32 API. This means that my efforts to write a cross platform Windows icon loader would have been largely useless for people wanting to display the correct icons for Windows programs on non-Windows systems.

So, I decided to also write an open source Windows PE and PE32+ resource decompiler from Microsoft’s file format specifications. It turned out to be great fun, I learned a lot in the process.

Usage from within Irrlicht is as follows:

/*
  The following code shows how to load a bitmap from one of the standard
  executables that comes with Windows XP/2k/Vista and display it in the GUI.
*/
 
  // create an instance of the loader and add it to the filesystem
  io::CArchiveLoaderRes* resLoader = new io::CArchiveLoaderRes(fs);
  fs->addArchiveLoader(resLoader);
 
  // We created it with new, so we must drop() when finished with it.
  resLoader->drop(); 
 
  // Now we can add an executable to the filesystem as an archive.
  // By default we ignore the paths which may mean we get the wrong language
  // but most of the time this won't matter.
  fs->addFileArchive("c:\\windows\\system32\\inetcpl.cpl"); 
 
  // now let's extract a bitmap and add it to the GUI
  guienv->addImage(driver->getTexture("4474.bmp"), core::vector2di(0,0));

This is currently in my personal SVN repository until it is tidied up, see the docs there for more info.

If you find this code useful and adapt it to be used outside of Irrlicht, please let me know. :-)