6:05 AM

resource hacker Tutorial2

Ultimate Guide to RESOURCE HACKER
!!! WARNING !!!

Playing with system files using resource hacker can be
Dangerous for your system and it can make your
system not working.

So use it at your own risk!

First of all hi to all "cynides"

So many members hv asked me a lot of questions about Resource Hacker, like:

=> How to replace existing Resources ( Bitmaps, AVI, Icons, etc.) in a file?
=> How to add ur own resources?
=> How to change Menus/ Strings?

and so on...

I was working on this post for the last 1 weak.

So here I'll try to cover all such questions and many other tips-n-tricks.
So here we go.....

NOTE: I hv divided this tutorial in 2 parts:


Basic part contains Basic details, like viewing/replacing resources, etc.
Advanced part covers some advance information which is described for geeks. Like Adding ur own resources, using scripts with resource hacker, etc.


What is Resource Hacker:

Resource Hacker is a Free s/w to edit 32-bit windows files (DLL, EXE, CPL, and many other). U can add/delete/view/rename/modify existing resources in a file using this gr8 piece of s/w.

Download Link:

U can d/l Resource Hacker from h**p://delphi.icm.edu.pl/ftp/tools/ResHack.zip
U don't need to install it, simply extract the files and run the s/w. It also doesnt make any entry in Registry!

Using Resource Hacker:

When u open a file in Resource Hacker, it shows various directories in left-side pane, like:

String Table
Version Info

and so on...
These directories vary from file to file!


Following is a small description of these directories:

AVI : This directory contains AVI files.
Cursor : This directory contains Cursor files.
Bitmap : This directory contains Bitmaps.
Icon : This directory contains Icons.
Menu : This directory contains various Menus.
Dialog : This directory contains various Dialog boxes.
String Table : This directory contains various Strings.
Accelerators : This directory contains Shortcut keys.
Version Info : This directory contains version information of the file.

Viewing Resources:

U can view any resource embedded in the file. Simply expand the directory and click on the name of the resource.
Actually each resource contains 3 parts:

Resource Type
Resource Name
Resource Language

Resource Type : Its indicate that the resource is an AVI/Bitmap/Menu
Resource Name : It describes the name of a resource, no 2 resource can hv the same name.
Resource Language : Its the language used in the file. For ENGLISH its 1033.

Changing the Resources:

=> For Icon/Cursor/Bitmap:

1) Select the resource ( e.g. Bitmap -> 131 -> 1033 ).
2) Click on Action -> Replace Icon/Cursor/Bitmap....
3) It'll open a new window, click on Open file with new
Icon/Cursor/Bitmap button.
4) Select the desired resource in the OPEN dialog box and
click on Open button and then Replace.

=> For other resources like AVI:

Its a little bit different.

1.) Click on Action -> Replace Other Resource....
2.) It'll open a new window, click on Open file with new resource button.
3.) Select the file and click on Open button.
4.) Now u hv to give the required information for this resource,
which I mentioned. Its a little bit different.


Resource Type
Resource Name
Resource Language

In type give the type of resource, e.g. if u r replacing AVI file then give the type as AVI.
In name give the exact name of the existing resource which u want to replace with this new one.
In language give 1033 for English.

5) And finally click on Replace button.

=> For Menus/Strings/Dialogs:

To change String/Menu/Dialog boxes, Select the desired resource, e.g., String Table -> 4 -> 1033, and make ur changes and then click on Compile Script button. It'll compile the script and will give ERROR if something goes wrong so that u can correct the problem!

Adding ur own Resources:

Adding new Bitmaps/Icons/Cursors/AVIs:

1) Click on Action -> Add a new Resource....
2) Click on Open file with new resource button.
3) Select the desired resource and click on Open button.
4) Give Resource Type/Name/Language.
(Remember: Resource Name should be different than the
existing resources.)
5) Click on Add Resource button.

Adding new Menu-items:

U can also add ur own Menu-items, like u can add extra menu (e.g., ur name) in Desktop Context Menu, etc.

1.) Goto desired menu, e.g., Menu -> 215 -> 1033, and add a
line anywhere inside POPUP "" or something like that in
following format:

MENUITEM "ur_desired_string", 12345, MFT_STRING, MFS_GRAYED | MFS_DEFAULT


"ur_desired_string" is the text which will be displayed on screen.
12345 is the the identifier, which must be different than other menuitems.
MFT_STRING describes that its a Menuitem with some text.
MFS_GRAYED disables our menuitem. U can also change it to MFS_ENABLED to enable it.
MFS_HILITE automatically select our menuitem. u can ignore it.
MFS_DEFAULT set our menuitem BOLD. u can also ignore it.

Actually u can only give MENUITEM "ur_desired_string", 12345 and Resource Hacker will automatically add other parts.


Adding Newly added Resources in Dialog Boxes:

Once u hv added ur own Icons/Bitmaps/AVIs, u may want to add them in dialog box so that they can be displayed when we open some dialog box (like RUN, Progress Dialog box, etc.).

1.) Goto the desired dialog box, in which u want to add ur own
resource, e.g., Dialog -> 1020 -> 1033.
2.) Right-click on the dialog box and select Insert Control option.
3.) It'll open a new window, where u'll see many controls,
like BITMAP, LABEL, ICON, BUTTON, SysAnimate32 (for AVIs), etc.
4.) Simply click on the desired control, like to use ur own added
Bitmap click on the BITMAP control or to use ur own added AVI click on SysAnimate32 control. U can also add Date/Time control by clicking on SysDateTimePick32 control.
5.) Don't forget to fill the Caption entry. Actually we hv to enter
the resource name in Caption so that our added resource can
be displayed on that place! e.g., if u hv added a Bitmap and
gave it name as 401, then give 401 in Caption.

PS: For AVI Control ( SysAnimate32 ), u hv to add # before the name in Caption. e.g., if the AVI name 144, then put #144 in Caption

6.) Finally click on OK button & Compile the script.
7.) U can change its position on the dialog box by simply dragging
it to ur desired position.

Using Scripts in Resource Hacker:

We can also use Resource Hacker from Command line w/o going thru its GUI and also can automate many repeatative tasks to save our time.[=)]

U can use the scripts in 2 forms:

1.) Single command
2.) Multiple commands

1.) Single Command:

Some useful commands with their format r as follows:

-add ExeFileName, ResultingFileName, ResourceAddress, ResourceType, ResourceName,
-addskip ExeFileName, ResultingFileName, ResourceAddress, ResourceType, ResourceName,
-addoverwrite ExeFileName, ResultingFileName, ResourceAddress, ResourceType, ResourceName,
-modify ExeFileName, ResultingFileName, ResourceAddress, ResourceType, ResourceName,
-extract ExeFileName, ResourceAddress, ResourceType, ResourceName,
-delete ExeFileName, ResultingFileName, ResourceType, ResourceName


ExeFileName : The original file which we want to edit in Resource Hacker
ResultingFileName : The name which we want to give when we save the file.
ResourceAddress : The resource address (like Bitmap location on our HDD).
ResourceType : The resource type (like Bitmap, AVI, etc.).
ResourceName : Resource name (like 131, 1020, etc.).

EX:- ResHacker.exe -addoverwrite explorer.exe, explorer1.exe, MyImage.bmp , bitmap, 143,

2.) Multiple commands

To use script first u hv to create a script file in notepad and then give following command:

ResHacker.exe -script ScriptFileName

Here: ScriptFileName is the name of the script file which u made in notepad.



-addoverwrite ResourceAddress, ResourceType, ResourceName


EXE= is the original file location
SaveAs= is the saved file location
Log= is the LOG file location which will store the log of the process

In [COMMAND] section, we give the commands which we want to execute.

U can omit the LOG entry, then Resource Hacker will automatically create a LOG file named "ResHacker.log".

Thats all for now guys! I hv tried to cover all points realted to Resource Hacker!
If u hv further queries, pls ask here. I'll try my BEST to answer them.