All About Resource Hacker in a Brief Tutorial



NOTE: If you are facing problems while saving a file after editing in resource hacker, make sure you have disabled WFP (Windows File Protection) service using WFP Patcher, it can be found in our "Downloads" section.

Also if you are getting "Can't create file..." error message, it means you have edited and saved the same file in past and a backup file having "_original" in its name exists in the same folder, which needs to be deleted before saving the file again. Just go to the folder containing the file and delete the backup file.

http://img.photobucket.com/albums/v374/vishaal_here/Resource_Hacker_Logo.png

Resource Hacker is a small but excellent tool to modify system files like DLL, EXE, CPL, etc. You can even change Windows look by editing various Windows files and replacing their resources using Resource Hacker.

You can download it using following links:

Download Link | Mirror | New 3.5.2 Beta Version

Its a portable application, so you don't need to install it. Simply extract the ZIP file and run the extracted EXE file.

This tutorial will help you in understanding this tool and will teach you how to use it. For your convenience, we have divided this tutorial in 2 parts:

  • PART 1: BASIC INFORMATION
  • PART 2: ADVANCED INFORMATION

Part 1 provides basic details like viewing or replacing existing resources in a file, etc. Part 2 covers some advance information for geeks, like adding new resources, using scripts, etc.

PART1 : BASIC INFORMATION

[Using Resource Hacker]

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

  • AVI - Contains AVI files
  • Cursor - Contains Cursor files
  • Bitmap - Contains BMP files
  • Icon - Contains Icons
  • Menu - Contains Menus
  • Dialog - Contains Dialog boxes
  • String Table - Contains Strings
  • Accelerators - Contains Shortcut keys
  • Version Info - Contains Version information of the file

[Viewing Resources]

You can view resource present in the file by expanding the directory given in left-side pane and clicking on the name of the resource. Each resource contains 3 important attributes:

  • Resource Type
  • Resource Name
  • Resource Language

[Changing Resources]

For Icons / Cursors / Bitmaps:

1. First select the resource ( e.g. Bitmap -> 131 -> 1033 ).

2. Now click on Action -> Replace Icon or Cursor or Bitmap....

3. It'll open a new window, click on Open file with new Icon or Cursor or Bitmap button.

4. Select the desired resource using OPEN dialog box, click on Open button and then click on Replace button.

For Other Resources like AVI:

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 you'll need to provide following required information for the resource, which we mentioned earlier:

  • Resource Type
  • Resource Name
  • Resource Language

Resource Type: Mention type of the resource, e.g. if you are replacing AVI file, mention the type as AVI

Resource Name: Provide the same name of the existing resource which you want to replace

Resource Language: Provide language code for the resource, e.g. 1033 for English. You can check existing resource's language code.

5. At last click on Replace button.

[For Menus / Strings / Dialogs]

To change any String, Menu or Dialog box, Select the desired resource, e.g. String Table -> 4 -> 1033, make your changes and at last click on Compile Script button.

It'll immediately compile the script. If you made any mistake while modifying the resource, it'll generate error message so that you can fix it.

PART2 : ADVANCED INFORMATION

[Adding New Resources]

Adding New Bitmaps / Icons / Cursors / AVIs:

1. Click on Action -> Add a new Resource....

2. Now click on Open file with new resource button.

3. Select the desired resource and click on Open button.

4. Give Resource Type, Name and Language as mentioned earlier. But keep in mind that Resource Name should not match with any existing resources name.

5. At last click on Add Resource button.

Adding New Menus:

Go to desired menu, e.g. Menu -> 215 -> 1033. Now add a new line anywhere inside POPUP "" using following format:

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

Where:

  • "Custom_String" is the actual text which you want to show in menu.
  • 12345 is the identifier. It must be different from existing menuitems.
  • MFS_GRAYED disables the menuitem. You can change it to MFS_ENABLED if you want to show your menuitem enabled.
  • MFS_DEFAULT shows your menuitem in BOLD. You can omit it.
  • You can also add a new attribute in the code MFS_HILITE which automatically selects your menuitem.

In fact you can only add following new line in code:

MENUITEM "Custom_String", 12345

And Resource Hacker will automatically insert other remaining values as mentioned above.

[Inserting Newly Added Resources in Dialog Boxes]

Once you finish adding new Icons / Bitmaps / AVIs, you can insert them in any dialog box so that you can show in various Windows dialog boxes like RUN, Progress Dialog box, etc.

1. Go to the desired dialog box, e.g. Dialog -> 1020 -> 1033

2. Right-click in the dialog box and select Insert Control option.

3. It'll open a new window. You'll see many controls in the new window, like BITMAP, LABEL, ICON, BUTTON, SysAnimate32 (for AVIs), etc.

4. Click on any desired control, e.g. to insert a Bitmap, click on the BITMAP control or to insert an AVI, click on SysAnimate32 control.

PS: You can also insert Date/Time in dialog box using SysDateTimePick32 control.

5. Don't forget to fill the Caption entry. You need to enter the Resource Name in Caption textbox, e.g. if you have added a Bitmap and set its Resource Name as 401, then give the same 401 in Caption textbox.

PS: For AVI Control ( SysAnimate32 ), you'll need to append # in Caption value, e.g if the AVI name is 144, then put #144 in Caption textbox.

6. At last click on OK button & then Compile the script.

7. If you want to change the position of the new control in dialog box, simply click on the control and drag it to your desired location or you can also use arrow keys to move it.

Using Scripts in Resource Hacker

We can also run Resource Hacker using Command Prompt and can use scripts to automate lots of repeatative tasks to save our time.

You can use scripts in 2 ways:

  • Single Command
  • Multiple Commands

[Single Command]

You can use following commands in Command Prompt to perform actions using Resource Hacker:

-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,

Where:

  • ExeFileName - Source file name
  • ResultingFileName - Output file name
  • ResourceAddress - Resource location (e.g. Bitmap path stored in your hard disk)
  • ResourceType - Resource type (e.g. Bitmap, AVI, etc.)
  • ResourceName - Resource name (e.g. 131, 1020, etc.)

Example:

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

[Multiple Commands]

You can also run a series of commands using script. First you'll need to create the script file using Notepad and then you can run it using following command:

ResHacker.exe -script ScriptFileName

Where, ScriptFileName is the name of the script file which you created in Notepad.

Following is the required format of the script file:

[FILENAMES]
Exe=
SaveAs=
Log=
[COMMANDS]
-addoverwrite ResourceAddress, ResourceType, ResourceName

Where:

EXE= contains source file name
SaveAs= contains output file name
Log= contains LOG file name which will store a detailed log of the operation

[COMMANDS] section contains the command-set which we want to perform on the source file.

PS: You can omit the LOG= entry in script file. In this case, Resource Hacker will automatically create a LOG file with the name "ResHacker.log".

That's all for now. If you have any query, please feel free to ask in our comments section.

More Resource Hacker Tutorials

Complete list of AskVG articles



This article was posted in Resource Hacker, Software Zone.


Share |


Related Articles

Popular Articles



418 Comments

  • VG

    ^^ Indeed. If you open the file in Resource Hacker, you can change the default icon. ;)

  • Is there a way to replace multiple AVI, BITMAP and ICON instead of doing it one by one?

  • VG

    ^^ You'll have to use Scripts for this task. ;)

  • Thanks for the quick reply. A recent update I installed from Microsoft replaced my shell32 and all my bitmaps, icons and avi's changed back to the original ones. I am able to extract all those Vista like bitmaps, icons and avi's but have to google a bit now to find out how to use scripts to put them back in.

  • hey VG,
    In your "Transform you windows xp to vista (without any transformation pack) you had us change the background? image of the progress bar to a pic...how/where does the reference to that pic get inserted into the actual progress bar window dialog...the pic is .bmp (ref. 14354) and the dialog is 1020 but i cannot find any relation to the 2 that make the actual dialog change like it does with your tutorial...awesome tutorials by the way...keep up the great work.

  • VG

    You have to manually add the BITMAP at the mentioned location and then put a reference to it in the dialog box.

  • sorry, i mentioned the wrong location...i meant to refer to the logoff/shutdown dialog that had a bitmap placed as what seems to be a background image...in the tutorial (and i hope i am not posting in the wrong area) ...i suppose my question is where is the dialog for the logoff/shutdown resource located...i know the bitmap resources are in shell32.dll but i cannot locate the actual dialog window settings...is there an actual editable dialog entry for the logoff/shutdown window? i have only looked in shell32.dll (@ dialog ref. 1089) and msgina.dll (@ dialog ref. 20100) but neither seem to reference the bitmap resources changed from the tutorial...( btw, i followed the tutorial and everything works the way it is suppoed to i just wanted to edit further and was trying to locate these settings for template-like reference...thanks)

  • VG

    The file containing Shutdown/log off resources is "%windir%\System32\msgina.dll".
    If you want to change the BITMAP, then simply replace following bitmaps:

    20140
    20141
    20142
    20143
    20150

    The dialog box for shutdown is:

    20100

  • ok...maybe we are on different waves...so far, i know all of what you have said...what i was wondering was using Resource hacker, i open msgina.dll, i scroll down to the dialog 20100, and i see a "script"...how / where in that script does it tell the dialog to use resources bitmaps listed above in your post...( or should i say, how did YOU figure out witch resources to modify so that they work?)

    is it the flag control? is it the DS_SETFOREGROUND thing at the top, or is it something somewhere else completely...

    my purpose is to add a background image to cover the dialog window of any/every dialog window that pops up. (similiar to how it does in the shutdown/logoff dialog

  • VG

    Ah. Now you told the right point which you wanted. :cool:
    So you want to add a bitmap in any dialog box background like I have done in RUN dialog box.

    Pls read following points in above tutorial:

    Adding new Bitmaps/Icons/Cursors/AVIs:
    Adding Newly added Resources in Dialog Boxes:

    You have to simply add a BITMAP and then insert a BITMAP in the dialog box and give the same label.

Add a Comment

NOTE: If you can't see your comment, please be patient. It'll appear as soon as we approve it.


Create an avatar that will appear with your comment.