Developer Goodies: ListResources to create an XML file from binary resources

At some point you might need to start paying special care for resources. Why? Perhaps there might be a number of reasons, I had to when I was dealing with first OEM versions of software and then internationalization. The whole idea is to let development team keep on working on regular version of software, in English language, while build OEM versions and localized versions of software by only manipulation with resources. It is an extremely important aspect of development because engineers always have full hands of work to do and there is no justification for getting extra work for them to deal with.

The first stage is development of regular English version of software and then other people replace resources to achieve desired branding (strings, titles, messages, icons, logos, version information, digital signatures; localized version whether they are resource duplicates for other languages or satellite DLLs), synchronize translations, prepare setup and distribution files.

One of the really simple and useful utilities on this way is the one that converts linked resources into a human readable file, so that it is possible to search for specific string through all resources of a binary (and actually all resources of the package if a batch makes such text files out of all binaries and then Find in Files Visual Studio .NET IDE feature is used).

ListResources writes an XML formatted file and prints infomration about:

  • resource types, identifiers and languages
  • extended information about:
    • menus RT_MENU
    • dialog templates RT_DIALOG
    • string tables RT_STRING
    • message tables RT_MESSAGETABLE
    • version information RT_VERSION
C:\ListResources "%WINDIR%\system32\winhttp.dll" >winhttp.xml

<ResourceTypes Path=”C:\WINDOWS\system32\winhttp.dll>
<ResourceType Type=”REGINST TypeName=”REGINST>
<ResourceName Name=”REGINST>
<ResourceLanguage Language=”1033 LanguageName=”English Size=”887 Digest=”721e554b610a3b07538204583da411eb />
</ResourceName>
</ResourceType>
<ResourceType Type=”TYPELIB TypeName=”TYPELIB>
<ResourceName Name=”#1>
<ResourceLanguage Language=”1033 LanguageName=”English Size=”8460 Digest=”249b65118804778f9ed7ae9d154f93db />
</ResourceName>
</ResourceType>
<ResourceType Type=”#11 TypeName=”Message Table>
<ResourceName Name=”#1>
<ResourceLanguage Language=”1033 LanguageName=”English Size=”7980 Digest=”949f0ef6cf1303c62f7fbb53f5a18465>
<Message HexCode=”0x00000001 Code=”1 Text=”%1 Digest=”3427795bc6ca28fa971b7f822a73b994 />
<Message HexCode=”0x00000002 Code=”2 Text=”%1 Digest=”3427795bc6ca28fa971b7f822a73b994 />
<Message HexCode=”0x00000004 Code=”4 Text=”%1 Digest=”3427795bc6ca28fa971b7f822a73b994 />
<Message HexCode=”0x00002ee0 Code=”12000 Text=”WINHTTP_ERROR_BASE Digest=”978b9da3a79491fbd3b91afaf0334db3 />
<Message HexCode=”0x00002ee1 Code=”12001 Text=”No more WinHttp handles can be allocated Digest=”071649fd2596a3323e789e75d71f3422 />

One of the uses of the utility was to write all resources into XML files and search to make sure that in process of re-branding no original software title remained in the entire distribution.

A partial Visual C++ .NET 2008 source code is available from SVN, release binary included.

One Reply to “Developer Goodies: ListResources to create an XML file from binary resources”

Leave a Reply