The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

    • RT @mmeeuw: Thierry Baudet over de “lange arm van Erdogan” 2016 en Thierry Baudet over de lange arm van Poetin in 2022… 1 hour ago
    • RT @VogelvrijeHArts: Van alle patiënten die de Praktijkondersteuner GGZ (POH-GGZ) in de huisartspraktijk ziet, heeft slechts 30% een psychi… 1 hour ago
    • RT @IntoTheShitter: West Texas storm chaser Laura Rowe captured the picture of a lifetime, fantastic shot of a mature supercell thunderstor… 1 hour ago
    • @helpdeskert Afwisselend pielen op mijn telefoon en proberen te slapen. Lukt soms. 1 hour ago
    • RT @locuta: Italië zelf moet die troep gewoon niet denk RT @NBCNews: Domino's closes its last branch in Italy, citing increased competiti… 4 hours ago
  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,856 other followers

Resource decompiler – converting/decompiling/extracting .RES files into .RC files and separate resources

Posted by jpluimers on 2016/07/07

via: Resource decompiler

One day I’m going to need ResourceHacker as it has an -extract option to extract resources.

The above link even has a batch file that can server as a start automating that process:

@echo off
set file="GeneSys"

if exist %file%.rc del %file%.rc

ResHacker.exe -extract %file%.res, %file%.rc,  Bitmap,,
ResHacker.exe -extract %file%.res, temp.rc,  Icon,,
type temp.rc >>%file%.rc
ResHacker.exe -extract %file%.res, temp.rc,  Dialog,,
type temp.rc >>%file%.rc
ResHacker.exe -extract %file%.res, temp.rc,  Menu,,
type temp.rc >>%file%.rc
ResHacker.exe -extract %file%.res, temp.rc,  StringTable,,
type temp.rc >>%file%.rc
ResHacker.exe -extract %file%.res, temp.rc,  Accelerators,,
type temp.rc >>%file%.rc
ResHacker.exe -extract %file%.res, temp.rc,  VersionInfo,,
type temp.rc >>%file%.rc
del temp.rc

I save it as extract.bat and a commandline usage: extract GeneSys will extract all the resources from GeneSys.res


PS: as the MASM forum sometimes nags with logins, I saved the above page in the wayback machine.

I’ve verified that [WayBack] ResourceHacker and the downloads ([WayBack] installer and [WayBack] portable) are there too.

PS: 20190507

In the mean time, the commandline syntax changed, and I discovered that resource extraction requires the target file to be of type .rc (otherwise you get an error Error: Inappropriate file extension for this resource type.
) with no output file at all, and that binary resources (including any RCDATA) are extracted as binary files..

The syntax is this:

>D:\bin\bin\resource_hacker\ResourceHacker.exe -help commandline

Resource Hacker Command Line Syntax:

Command line instructions ...

Switch     Parameter
=========  ====================================================================
-open    : filename - the name of the file that is to be modified ...
           Windows PE file (*.exe, *.dll etc) or resouce file (*.res or *.rc)
-save    : filename - the new name of the modified or newly created file ...
           either a modified opened file or an extracted resource
-resource: filename - contains a resource being added to the opened file.
-action  : action to be performed on the opened file
           add             - add a resource, fails if it already exists
           addoverwrite - add a resource, overwrites if it already exists
           addskip        - add a resource, skips if it already exists
           compile        - compiles a text resource file (*.rc)
           delete          - delete a resource
           extract         - extract a resource
           modify         - modify a resource
           changelanguage(langID) - changes the language of ALL resources (nb: avoid any spaces)

-mask    : resource mask - Type,Name,Language
           commas are mandatory but each of type, name & language are optional
-log     : filename or CONSOLE or NUL
           CONSOLE: can be abbreviated to CON
           logs details of the operation performed
           switch is optional - if omited, defaults to resourcehacker.log
-script  : filename - contains a multi-command script, NOT a resource script
           for more info: -help script
           other switches are ignored.
-help    : options - commandline or script (always logged to CONSOLE)
           other switches are ignored.
=========  ====================================================================

1. Switch identifiers may be abbreviated down to a single char (eg -res or -r).
2. Switch instructions do not have to be in any particular order.
3. File names that contain spaces must be encased within double quotes.
4. The changelanguage action changes the language ID of ALL resources irrespective of any mask.

Extracting all resources is like this:

D:\bin\bin\resource_hacker\ResourceHacker.exe -open "D:\Path with spaces\Binary.res" -save "D:\Path with spaces\Resources.rc" -action extract -mask


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: