Resource Hacker
Resource Hacker is a freeware utility developed by Angus Johnson for viewing, editing, compiling, and decompiling resources within 32-bit and 64-bit Windows executable files (such as *.exe and .dll) and resource files (.res and *.mui).[1] It enables users to inspect and modify embedded elements like icons, cursors, menus, dialog boxes, string tables, and accelerators through a graphical interface, including WYSIWYG designers for certain resource types.[1] Originally released in 1999, the software has been maintained as freeware under a license that prohibits illegal modifications, with the latest version, 5.2.8, updated on March 6, 2025.[1] The tool supports resource script compilation from *.rc files, handling directives such as #INCLUDE, #IF, and #DEFINE, as well as escaped strings for precise control over resource definitions.[1] It also offers command-line functionality for automation, with options like -open, -save, and -action to perform batch operations on files.[1] Notably, Resource Hacker does not unpack compressed executables, focusing instead on standard PE-format resources as defined in Microsoft documentation.[1] This makes it a specialized, lightweight alternative to more comprehensive development environments for tasks like software customization or reverse engineering legitimate applications.[1]Background
Purpose and Functionality
Resource Hacker is a freeware utility developed by Angus Johnson for viewing, modifying, adding, deleting, and extracting resources in 32-bit and 64-bit Windows executables (EXE, DLL, SCR) as well as resource files (RES, MUI, RC).[1] Windows resources refer to embedded components within these files that define key elements of an application's user interface and behavior, such as icons, cursors, menus, dialogs, bitmaps, and strings.[2] These resources are compiled into binary format during application development and loaded at runtime to provide reusable assets without embedding them directly in the code.[2] At its core, Resource Hacker serves as a resource decompiler to extract and display binary resources in editable formats like images or text, and as a compiler to generate binary resources from RC script files.[1] This functionality facilitates direct manipulation of application components without requiring the original source code.[1] The tool's primary benefit lies in enabling non-programmers to customize visual and structural aspects of Windows software, supporting tasks like personalization or debugging through straightforward resource management.[1]Developer and Initial Release
Resource Hacker was developed by Angus Johnson, an independent programmer specializing in Windows utilities.[1] As the sole creator, Johnson focused on creating accessible tools for resource management in Windows applications, drawing from his expertise in software development for the platform. The tool's initial release occurred in 1999, as indicated by the copyright notice spanning from that year onward.[1] Johnson's motivation stemmed from the need for a no-cost solution to compile and decompile resources in Windows binaries, offering a graphical interface that made the process more approachable than command-line alternatives like the Microsoft Resource Compiler.[1] By providing both GUI and command-line support, the tool addressed accessibility barriers for non-professional users editing executable files.[1] Distribution began as freeware directly from Johnson's personal website at angusj.com, ensuring no advertisements, nag screens, or licensing costs, with further redistribution requiring his written approval to maintain control over its open-access model.[1]Technical Features
Supported Resource Types
Resource Hacker supports a comprehensive set of standard Windows resource types, enabling the viewing, editing, and compilation of elements embedded in Portable Executable (PE) files such as executables (.exe) and dynamic-link libraries (.dll). These resources are stored in the dedicated resource section of PE files, which organizes data into a hierarchical tree structure of types, names, and languages for efficient runtime access by applications.[1][3][4] The supported types include:- ICON: Defines icons or animated icons used for application symbols, window representations, and file associations; stored as binary image data in the PE resource section, loadable by identifier for display.
- CURSOR: Specifies cursor images or animated cursors for mouse pointers; stored similarly to icons as binary data, accessible by name or ID for user interface interactions.
- BITMAP: Contains bitmap images for graphical elements like buttons or backgrounds; embedded as raw pixel data in the resource section, retrievable for rendering.
- AVI: Embeds Audio-Video Interleave (AVI) files for animations and multimedia playback; stored as binary video data, used to enhance application visuals.
- STRING TABLE: Organizes text strings for user interface elements and messages, facilitating localization; stored as arrays of Unicode or ANSI strings in blocks of 16 entries, loaded on demand.
- MENU: Describes menu structures, including items, submenus, and pop-ups; defined in script format and stored as compiled templates in the PE resource section for dynamic menu creation.
- DIALOG (including DIALOGEX): Defines dialog box templates for windows and controls, with DIALOGEX providing extended attributes like font specifications; stored as binary templates outlining layout and properties.
- ACCELERATOR: Maps keyboard keys to menu commands or actions for shortcuts; stored as tables of key-event pairs in the resource section.[5]
- RCdata (binary data): Holds arbitrary raw binary data, such as custom files or configurations; stored without predefined format, allowing flexible application-specific use.
- VERSIONINFO: Provides metadata like file version, company name, and legal copyright; structured as value-name pairs in the resource section, queryable by system APIs.[6]
#INCLUDE for incorporating external files, #IF, #IFDEF, #IFNDEF, #ELIF, #ELSE, and #ENDIF for conditional compilation, and #DEFINE with #UNDEF for macro definitions; it also supports escaped strings (e.g., \t for tabs, \n for newlines) and comments via // or ;.[1]
Editing and Compilation Capabilities
Resource Hacker enables the decompilation of resources embedded in Windows executable files, such as .exe, .dll, and .scr formats, as well as resource libraries like .res and .mui files, into editable RC script formats or individual extractable files including ICO and BMP images.[9] This process converts binary data into human-readable text for resources like strings, menus, and dialogs, while binary resources such as icons are exported as standalone files for further manipulation.[9] Modification capabilities allow users to add, delete, rename, or replace resources directly within the target file. For example, text strings can be altered to update application messages, and visual elements like images can be substituted with new content imported from external sources. The tool provides WYSIWYG editing specifically for menu and dialog resources, permitting intuitive visual adjustments to layouts and elements without requiring manual code entry.[9] Compilation features support the building of RC scripts into RES files or their direct injection into executables, facilitating the reconstruction of modified resources. Binary resources, such as images, are handled through integration with external editors, where users can export the content, edit it in specialized applications like image processors, and then re-import the changes. Resource Hacker processes RC scripts with support for preprocessor directives including #INCLUDE for file inclusion, #IF for conditional logic, #DEFINE and #UNDEF for macros, and escaped characters such as \t for tabs, \n for newlines, and Unicode sequences for international text handling.[9] Advanced actions include the use of script templates to automate resource additions and modifications via multi-command script files executed through the command line, enabling batch operations like sequential adds or deletes with options to overwrite existing resources or apply masks for resource types, names, and languages.[9]User Interface and Operation
Graphical User Interface
Resource Hacker's graphical user interface centers on a dual-pane main window designed for efficient navigation and editing of executable resources. The left pane features a hierarchical tree view that organizes resources by type, such as ICON, BITMAP, MENU, DIALOG, and STRING TABLE, enabling users to expand folders and select specific items like individual icons or dialog elements.[1] Upon selection, the right pane serves as a preview area, displaying visual content like images directly or rendering decompiled text for scriptable resources, while binary data appears in a read-only format for inspection.[1] This layout allows users to quickly assess and interact with the resource structure without leaving the primary interface. Editing operations are tailored to resource types through integrated modes that support both textual and visual modifications. For RC script-based resources, such as menus or string tables, a built-in text editor allows direct manipulation, with compilation available via keyboard shortcuts like F5 or menu options.[10] Binary resources can be examined using a read-only hex viewer, with editing requiring export and import of the resource. Visual elements benefit from specialized editors, notably the dialog designer, which employs a WYSIWYG approach with drag-and-drop controls for inserting items like buttons or bitmaps, and arrow keys or direct dragging for repositioning.[10] Navigation within the GUI relies on intuitive file handling tools, including open and save dialogs that support common formats like .exe, .dll, and .rc files, allowing seamless loading of executables or resource scripts.[1] Users can locate resources by browsing the tree view or using context menus for actions like adding or deleting entries. For output, the interface offers versatile saving mechanisms: resource scripts can be compiled directly to .res files, individual resources extracted to files or folders via right-click options, and entire modified executables saved with an automatic backup of the original, typically named [filename]_original.exe, to prevent data loss.[11]Command-Line Interface
Resource Hacker provides a command-line interface (CLI) that enables automated manipulation of resources in executable files, resource files, and scripts without invoking the graphical user interface. The basic syntax follows the formResourceHacker.exe [switches] [parameters], where switches such as -open specify the input file (e.g., .exe, .dll, .rc, or .res) to load, -save defines the output filename or directory for writing changes, and -action determines the operation to perform, including add, delete, extract, or modify. Switches are order-independent, with filenames containing spaces requiring double quotes for proper parsing.[1]
Key actions facilitate common resource operations. For instance, the -add action injects a resource file into a destination executable, failing if the resource already exists; -addoverwrite performs the same but replaces existing resources, while -addskip skips duplicates. Extraction uses -extract with a -mask parameter to specify the resource type, name, and optional language (e.g., rh.exe -open source.exe -save output.res -[action](/page/Action) extract -[mask](/page/Mask) ICONGROUP,MAINICON,), pulling items like icons or dialogs to a file or folder. Compilation of .rc scripts to .res files is handled via -action compile, and deletion targets specific resources with -delete. Logging is configurable via the -log switch (e.g., to CONSOLE, NUL, or a file), defaulting to resourcehacker.log for error handling and auditing.[1]
The CLI supports processing of resource compiler (RC) files and custom scripts directly from the command line. Scripts are text files invoked with -script ScriptFile, structured with [FILENAMES] sections defining input (Exe=) and output (SaveAs=) paths, followed by [COMMANDS] sections listing actions like -add, -modify, or -extract with associated masks and resources. This enables batch processing of multiple operations, such as localizing an application by changing languages with -changelanguage(langID). Error handling integrates via log outputs, allowing verification of successes and failures in automated sequences.[1]