Friday 5 August 2011

0

All About Resource Hacker

  • Friday 5 August 2011
  • saurav garg
  • Share
  • Resource Hacker is a tool to edit Windows system files like .exe, .dll, .cpl, etc. You can edit these files and can change the look of various dialog boxes, menus and many other things in Windows.

    NOTE: This tutorial is divided into 2 parts:

    PART1 : BASIC INFORMATION
    PART2 : ADVANCED INFORMATION

    Basic part contains Basic details, like viewing/replacing resources, etc.

    Advanced part covers some advance information which is described for geeks. Like Adding your own resources, using scripts with resource hacker, etc.

    PART1 : BASIC INFORMATION

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

    Download Link:
    You can download Resource Hacker from here.
    You don't need to install it, simply extract the files and run the software. It also doesn't make any entry in Registry!

    Using Resource Hacker:
    When you open a file in Resource Hacker, it shows various directories in left-side pane, like:
    AVI
    Cursor
    Bitmap
    Icon
    Menu
    Dialog
    String Table
    Accelerators
    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:
    You 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/Cursor/Icon/String/etc.
    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 earlier.

    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!

    PART2 : ADVANCED INFORMATION

    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
    Here:
    "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,
    Here:
    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.

    Format of a script file:-
    [FILENAMES]
    Exe=
    SaveAs=
    Log=
    [COMMANDS]
    -addoverwrite ResourceAddress, ResourceType, ResourceName
    Here:
    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.
    You can omit the LOG entry, then Resource Hacker will automatically create a LOG file named "ResHacker.log".
      
    Subscribe us via E-mail and Add us on Facebook for daily updates and Plz also do click once on the ads displaying below or above the post for us.. :)

    0 Responses to “ All About Resource Hacker ”

    Post a Comment