Windows executables (or more specifically, Win32 PE files) often contain a small database of resources, these are graphics files, text strings, icons, and other programming paraphernalia. Often it can be advantageous to modify these resources, such as to modify a program's visual appearance or to correct a mistranslation in a string table. Anolis Resourcer is a "resource hacker" program which enables you to do this.
Resourcer also supports *.RES files, which is useful for native Win32 developers.
Extract all resources (or just "visual" resources) from a single file, or a directory full of executables in a couple of mouse-clicks. Select the "Batch Export" menu item under Tools or the Open Button's side menu.
See all the visual resources (icons, bitmaps, PNGs, etc) at a glance without having to extract them. Three thumbnail sizes available (16x16, 32x32, and 96x96)
Icon resources are stored in two places: the "directory" containing references to sub-images is stored in the Icon Directory resource, and the actual images that make up an icon are stored in the Icon Images area.
Most resource editors delete the old subimages before adding new ones and overwriting the directory. Resourcer has the option to "merge" icons instead, so you end up with the union of the original icon and the new file's icon.
Windows Vista introduced some changes to the resource model with "RC Config" and MUI files. Resourcer is aware of these changes and can work around them to achieve the results you're after.
If there's a resource data type that Resourcer doesn't support, you can code your own handler and get Resourcer to load it.
ResHacker hasn't been updated since 2002 and its development is officially on hold, it also doesn't support x64 executables or PNG icons. Resourcer is open-source (GPL on CodePlex) and under active development. For more reasons here's a table:
Feature | ResHacker | Resourcer |
---|---|---|
License | Closed Source | GPLv2 |
x64 Support | Crashes | Fully Supported |
Vista MUI Aware | No | Yes |
PNG Icon Support | Crashes | Yes |
Thumbnail View | No | Yes |
Batch Export | No | Yes |
Intelligent Icon Merging | No | Yes |
Extensible | No | Yes |
In the interests of honesty, there are some features that ResHacker supports that Resourcer does not (yet):
Feature | ResHacker | Resourcer |
---|---|---|
Batch Files | Yes | No (use *.cmd files to call Resourcer) |
RC Script Generation | Yes | No (save to RES and use Visual Studio to generate the RC) |
Delphi Form Resource Support | Yes | No |
Load Resources from a RES file for batch operations | Yes | No (data must be in individual files) |
Some programs, such as those developed with Delphi, store their resources inside other resources. If a program has been written in Delphi then you'll find various resources under the "RCDATA" type, these resources define the appearance of windows and forms and contain images and other data encoded directly. Resourcer does not currently process Delphi form resources, but it will do in future.
Other programs, such as that use the CLR (aka .NET Framework) or Java, store their resources differently. Because the CLR and Java are both cross-platform there's no use in storing resources in a Windows-specific fashion. The CLR has this notion of "resource streams" that are data files contained within a CLR Assembly, these streams can either be arbitrary files or a "ResourceSet": a strongly-typed collection of resources. Java programs store their resources inside JAR files, which are essentially zip files. To view Java resources there are numerous free Java resource editors available (or just rename the JAR file to *.ZIP and extract as usual). To view CLR resources you can download "Lutz Roeder's Resourcer", note that CLR resources are read-only.
Your file might have been compressed using an EXE compressor like UPX, in which case you'll need to decompress it first.
Until Resourcer adds in support for UPX compressed EXEs, you will need to download the UPX program yourself, then run it with these arguments: upx -d -o "Decompressed.exe" "Compressed.exe"
. Then open "Decompressed.exe" in Resourcer and it should work fine. Just remember to UPX-compress it when you're done.
Anolis Resourcer supports command-line arguments for GUI-free resource editing. A proper command-line program is in the works, but this should do you fine for now.
A error message box will appear if the operation was unsuccessful, otherwise it terminates with error 0 (aka "OK")
Resourcer has five arguments you can specify:
Argument | Value | Description |
---|---|---|
-op: | add, upd, ext, del | Required. The operation to perform (Add, Update, Extract, or Delete respectively). |
-src: | Path to a file | Required. The Win32 PE or RES file to modify or extract resources from. |
-type: | Resource type identifier | Required. Identifies the type of resource to work with. For string and integer identifiers just putting the value is sufficient. Note that some string values are synonymous with some integer values. Consult the table below. |
-name: | Resource name identifier | Required. Identifies the name of resource to work with. For string and integer identifiers just putting the value is sufficient. If a resource has a numeric string identifier then prefix the number with \" (backslash, followed by a double-quote) E.g.: -name:\"0. If a resource identifier starts with a double-quote symbol (unlikely) prefix it with \"\" . |
-lang: | Unsigned 16-bit number. | Required, except when updating or deleting. This argument is required for adding and extracting, but optional for deleting and updating. If this argument is ommited then all matching resources will be deleted or replaced with the contents of the specified file. |
-file: | Path to a file | Required, except when deleting. When adding or updating a resource the data is retrieved from this file. When extracting the resource is saved to this file. When deleting this argument is ignored. |
Notable Resource Type Identifiers
Type | Integer | Synonyms | Notes |
---|---|---|---|
Cursor Sub-Image | 1 | Cursors rarely have more than 1 sub-image. Replace cursors by altering the directory, not the individual subimages. | |
Bitmap Data | 2 | "Bitmap", "BMP" | Only *.bmp files can be read into a bitmap resource, you must convert from JPEG, GIF, or PNG first. |
Icon Sub-Image | 3 | Icons contain many subimages. It is not advisable to replace them directly. If you are going to replace them, ensure you have the right DIB format (dimensions and pixelformat) first. | |
Cursor Directory | 12 | "Cursor", "Cursordir", "Cursorgroup" | |
Icon Directory | 14 | "Icon", "Icondir", "Icongroup" |
Other type IDs exist but are not listed. Consult MSDN or the Anolis source (Anolis.Core\Core\ResourceIdentifier.cs) for an exhaustive list.
Add a new resource from a file:
Resourcer -op:add -src:"C:\exeToModify.exe" -type:icon -name:name -lang:1033 -file:"C:\iconToAdd.ico"
Update an existing resource with data from a file:
Resourcer -op:upd -src:"C:\exeToModify.exe" -type:icon -name:name -lang:1033 -file:"C:\newIcon.ico"
Update all existing resource languages with the specified type and name with data from a file:
Resourcer -op:upd -src:"C:\exeToModify.exe" -type:icon -name:name -file:"C:\newIcon.ico"
Extract a resource and save it to a file:
Resourcer -op:ext -src:"C:\exeToLoad.exe" -type:icon -name:name -lang:1033 -file:"C:\iconToSaveTo.ico"
Delete a resource:
Resourcer -op:del -src:"C:\exeToModify.exe" -type:icon -name:name -lang:1033