Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

[Solved] Resource hacker replace stringtable items


  • Please log in to reply
10 replies to this topic

#1 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 27 February 2012 - 09:55 PM

Hi

I'm trying to replace some string resources in a executable file, but always something goes wrong

I created a little batch script:
@echo off if "%~1"=="" exit if "%~x1" NEQ ".exe" exit goto write goto:eof :write cd res echo [FILENAMES]>script_reshack.txt echo Exe="%~1">>script_reshack.txt echo SaveAs="%~dp1%~n1_reshack.exe">>script_reshack.txt echo [COMMANDS]>>script_reshack.txt echo -modify dialog.res, dialog,,0 >>script_reshack.txt echo -modify menu.res, MENU,,0 >>script_reshack.txt echo -modify string_table1.res, STRINGTABLE, 1,0 >>script_reshack.txt echo -modify string_table2.res, STRINGTABLE,2,0 >>script_reshack.txt echo -modify string_table5.res, STRINGTABLE,5,0 >>script_reshack.txt if exist "script_reshack.txt" ResHacker.exe -script script_reshack.txt goto:eof


here's the log file from reshack:
[27 Fev 2012, 21:45:49] [FileNames] Exe=C:\Users\user\main_gui.exe SaveAs=C:\Users\user\main_gui_reshack.exe Log= [Commands] -modify dialog.res, dialog,,0   Modified: DIALOG,900,2057 -modify menu.res, MENU,,0   Modified: MENU,103,2057 -modify string_table1.res, STRINGTABLE, 1,0 -modify string_table2.res, STRINGTABLE,2,0 -modify string_table5.res, STRINGTABLE,5,0 Commands completed


Am I doing something wrong?, the strings aren't changed, only the dialog and menu.

Edited by DiOgO, 28 February 2012 - 11:35 PM.

Heroes, there is no such thing








#2 Mobius

Mobius

    Disassembling the fantasy

  • Active Members
  • PipPipPipPipPipPip
  • 873 posts

Posted 27 February 2012 - 10:15 PM

Not really to do with AutoIt but....

I am just curious as to why you don't just put all your modified resources into one .res file then run resource hacker with something like this:
ResHacker.exe -modify C:Usersusermain_gui.exe, C:Usersusermain_gui_reshack.exe, MYMODS.res , , ,


That way you do not have to go through the the process of writing a config/script for resourcehacker (nothing wrong with that btw).

Remember with res files you might not necessarily need to specify the resource mask.

Vlad
AutoCamo Another Aut2Exe wrapper
*

#3 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 27 February 2012 - 10:19 PM

Not really to do with AutoIt but....

I am just curious as to why you don't just put all your modified resources into one .res file then run resource hacker with something like this:

ResHacker.exe -modify C:Usersusermain_gui.exe, C:Usersusermain_gui_reshack.exe, MYMODS.res , , ,


That way you do not have to go through the the process of writing a config/script for resourcehacker (nothing wrong with that btw).

Remember with res files you might not necessarily need to specify the resource mask.

Vlad

how I put all in a one res file?

I used the GoRC.exe to convert them from .rc to .res :oops:

and when you say

Remember with res files you might not necessarily need to specify the resource mask.

you're saying do it like this: -modify string_table1.res ?

Heroes, there is no such thing


#4 Mobius

Mobius

    Disassembling the fantasy

  • Active Members
  • PipPipPipPipPipPip
  • 873 posts

Posted 27 February 2012 - 10:33 PM

how I put all in a one res file?

I used the GoRC.exe to convert them from .rc to .res :oops:

and when you say


you're saying do it like this: -modify string_table1.res ?

To save all as res.

1. Open your target exe with resourcehacker
2. In the menu select File -> SaveAs
3. In the 'Save File As' dialog where it says 'Save as type' click on the combo box
4. Select 'Resource files (*.res)' then in the 'File name' field put say: MYRES.res
5. Click Save.

You now have an exact duplicate of your target exe's resource table which you can modify with resource hacker.

The information about GORC would have been useful earlier on in your thread. and what pray tell did you craft the rc file with?

ResHacker.exe -modify C:Usersusermain_gui.exe, C:Usersusermain_gui_reshack.exe, MYRES.res , , ,

Yes thats right, by resource mask I mean the parts where you are defining the resource type , resource index , resource sub language.

You don't need to specify that part when using res files unless you wish to individually pick the type of resource within your res file to modify in the target binary.

Edited by Mobius, 27 February 2012 - 10:35 PM.

AutoCamo Another Aut2Exe wrapper
*

#5 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 27 February 2012 - 10:50 PM

To save all as res.

1. Open your target exe with resourcehacker
2. In the menu select File -> SaveAs
3. In the 'Save File As' dialog where it says 'Save as type' click on the combo box
4. Select 'Resource files (*.res)' then in the 'File name' field put say: MYRES.res
5. Click Save.

You now have an exact duplicate of your target exe's resource table which you can modify with resource hacker.

The information about GORC would have been useful earlier on in your thread. and what pray tell did you craft the rc file with?

ResHacker.exe -modify C:Usersusermain_gui.exe, C:Usersusermain_gui_reshack.exe, MYRES.res , , ,

Yes thats right, by resource mask I mean the parts where you are defining the resource type , resource index , resource sub language.

You don't need to specify that part when using res files unless you wish to individually pick the type of resource within your res file to modify in the target binary.

the res file created with these steps appears with strange letters and gives me a error about being probably compressed (the .exe ins't compressed)

I tried, save all the string tables in a rc file, and open it with reshacker, then I click in File>Save as>myfile.res (file type as res)>ok and occurs this error:


---------------------------
Resource Hacker
---------------------------
Access violation at address 0046177B in module 'ResHacker.exe'. Read of address 00000020.
---------------------------
OK
---------------------------

maybe ins't possible convert to res file this stringtable :/


(I could craft the stringtable rc with gorc, it gives me this error: Could not evaluate an ID which must be a number), I crafted with the restuner, one by one...

Heroes, there is no such thing


#6 Mobius

Mobius

    Disassembling the fantasy

  • Active Members
  • PipPipPipPipPipPip
  • 873 posts

Posted 27 February 2012 - 11:02 PM

All resources work in res files been doing it for years.

What is the target exe you are trying to modify?

Are you using the most up to date version of resourcehacker?

In resoure hacker did you know you can right click on 'String Table' entrance and select 'Save all resources' to obtain a proper rc file which is easily modified and pumped back into gorc.
AutoCamo Another Aut2Exe wrapper
*

#7 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 27 February 2012 - 11:11 PM

All resources work in res files been doing it for years.

What is the target exe you are trying to modify?

Are you using the most up to date version of resourcehacker?

In resoure hacker did you know you can right click on 'String Table' entrance and select 'Save all resources' to obtain a proper rc file which is easily modified and pumped back into gorc.

its a .exe from a compiled program with autoit

'Save all resources'->thats the first thing I did, and when I use the gorc occurs that error: Could not evaluate an ID which must be a number

EDIT: my reshacker version is 3.6.0.92

Edited by DiOgO, 27 February 2012 - 11:12 PM.

Heroes, there is no such thing


#8 Mobius

Mobius

    Disassembling the fantasy

  • Active Members
  • PipPipPipPipPipPip
  • 873 posts

Posted 27 February 2012 - 11:30 PM

its a .exe from a compiled program with autoit

'Save all resources'->thats the first thing I did, and when I use the gorc occurs that error: Could not evaluate an ID which must be a number

EDIT: my reshacker version is 3.6.0.92

Open your modified main_gui_reshack.exe with resource hacker then scroll down to one of the string table entrances you tried to modify, are there 2 entrances? say an entrance 0 plus another numerical entrance?

@echo off if "%~1"=="" exit if "%~x1" NEQ ".exe" exit goto write goto:eof :write cd res echo [FILENAMES]>script_reshack.txt echo Exe="%~1">>script_reshack.txt echo SaveAs="%~dp1%~n1_reshack.exe">>script_reshack.txt echo [COMMANDS]>>script_reshack.txt echo -modify dialog.res,,, >>script_reshack.txt echo -modify menu.res,,, >>script_reshack.txt echo -modify string_table1.res,,, >>script_reshack.txt echo -modify string_table2.res,,, >>script_reshack.txt echo -modify string_table5.res,,, >>script_reshack.txt if exist "script_reshack.txt" ResHacker.exe -script script_reshack.txt goto:eof


Are you absolutely sure that inside your generated res files you are using identical Resource Index & Resource sub language values to those that are within the compiled AutoIt executable?

'Save all resources'->thats the first thing I did, and when I use the gorc occurs that error: Could not evaluate an ID which must be a number

See what you mean about this, plus pumping a resource hacker generated rc file (from an AutoIt program) into my rc editor of choice causes all sorts of problems particularly with the string table entrances. (but for different reasons)

Edited by Mobius, 27 February 2012 - 11:46 PM.

AutoCamo Another Aut2Exe wrapper
*

#9 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 27 February 2012 - 11:44 PM

Open your modified main_gui_reshack.exe with resource hacker then scroll down to one of the string table entrances you tried to modify, are there 2 entrances? say an entrance 0 plus another numerical entrance?

@echo off if "%~1"=="" exit if "%~x1" NEQ ".exe" exit goto write goto:eof :write cd res echo [FILENAMES]>script_reshack.txt echo Exe="%~1">>script_reshack.txt echo SaveAs="%~dp1%~n1_reshack.exe">>script_reshack.txt echo [COMMANDS]>>script_reshack.txt echo -modify dialog.res,,, >>script_reshack.txt echo -modify menu.res,,, >>script_reshack.txt echo -modify string_table1.res,,, >>script_reshack.txt echo -modify string_table2.res,,, >>script_reshack.txt echo -modify string_table5.res,,, >>script_reshack.txt if exist "script_reshack.txt" ResHacker.exe -script script_reshack.txt goto:eof


Are you absolutely sure that inside your generated res files you are using identical Resource Index & Resource sub language values to those that are within the compiled AutoIt executable?

ya, I'm sure

Plain Text         
@echo off if "%~1"=="" exit if "%~x1" NEQ ".exe" exit if exist "%~dp1%~n1_reshack.exe" del /F /Q "%~dp1%~n1_reshack.exe" goto write :write cd res echo [FILENAMES]>script_reshack.txt echo Exe="%~1">>script_reshack.txt echo SaveAs="%~dp1%~n1_reshack.exe">>script_reshack.txt echo [COMMANDS]>>script_reshack.txt echo -modify dialog.res, dialog,,0 >>script_reshack.txt echo -modify menu.res, MENU,,0 >>script_reshack.txt echo -modify string_table7.res, STRINGTABLE, 7,0 >>script_reshack.txt echo -modify string_table8.res, STRINGTABLE, 8,0 >>script_reshack.txt echo -modify string_table9.res, STRINGTABLE,9,0 >>script_reshack.txt echo -modify string_table10.res, STRINGTABLE,10,0 >>script_reshack.txt echo -modify string_table11.res, STRINGTABLE,11,0 >>script_reshack.txt echo -modify string_table12.res, STRINGTABLE,12,0 >>script_reshack.txt echo -modify string_table313.res, STRINGTABLE,313,0 >>script_reshack.txt ResHacker.exe -script script_reshack.txt goto:eof

the problem is with the stringtable, I don't want to be do it one be one all the time :oops:

Convert the stringtable with gorc gives a error (I discribed it above...)
with the reshacker (rc to res, open the rc and save as res) occurs that memory error

using the converted res files, I cannot get the proper parameter to input the new stringtable to reshacker

Heroes, there is no such thing


#10 Mobius

Mobius

    Disassembling the fantasy

  • Active Members
  • PipPipPipPipPipPip
  • 873 posts

Posted 27 February 2012 - 11:54 PM

Post the exe file you are attempting to modify (if you have not packed or protected it there is absolutely no reason why you are failing to dump a res file to be modified).

Also if it is your program that you are modifying did you know that AutoItWrapper supports creating string table entrances using a simple directive plus an ini format file?

Ed:

Your sure? Then why are you still specifying a resource type plus index plus an incorrect sub language of 0!

if "%~1"=="" exit
if "%~x1" NEQ ".exe" exit
if exist "%~dp1%~n1_reshack.exe" del /F /Q "%~dp1%~n1_reshack.exe"
goto write
:write
cd res
echo [FILENAMES]>script_reshack.txt
echo Exe="%~1">>script_reshack.txt
echo SaveAs="%~dp1%~n1_reshack.exe">>script_reshack.txt
echo [COMMANDS]>>script_reshack.txt
echo -modify dialog.res, dialog,,0 >>script_reshack.txt
echo -modify menu.res, MENU,,0 >>script_reshack.txt
echo -modify string_table7.res, STRINGTABLE, 7,0 >>script_reshack.txt
echo -modify string_table8.res, STRINGTABLE, 8,0 >>script_reshack.txt
echo -modify string_table9.res, STRINGTABLE,9,0 >>script_reshack.txt
echo -modify string_table10.res, STRINGTABLE,10,0 >>script_reshack.txt
echo -modify string_table11.res, STRINGTABLE,11,0 >>script_reshack.txt
echo -modify string_table12.res, STRINGTABLE,12,0 >>script_reshack.txt
echo -modify string_table313.res, STRINGTABLE,313,0 >>script_reshack.txt
ResHacker.exe -script script_reshack.txt
goto:eof

KEY of above:
Red = Not necessary if you are certain the values in your res file match the exe file.
Green = See Red. plus your value of 0 is actually incorrect for what you are trying to do (and probably the cause of all this pain)

So either:
if "%~1"=="" exit if "%~x1" NEQ ".exe" exit if exist "%~dp1%~n1_reshack.exe" del /F /Q "%~dp1%~n1_reshack.exe" goto write :write cd res echo [FILENAMES]>script_reshack.txt echo Exe="%~1">>script_reshack.txt echo SaveAs="%~dp1%~n1_reshack.exe">>script_reshack.txt echo [COMMANDS]>>script_reshack.txt echo -modify dialog.res, dialog,,0 >>script_reshack.txt echo -modify menu.res, MENU,,0 >>script_reshack.txt echo -modify string_table7.res,,, >>script_reshack.txt echo -modify string_table8.res,,, >>script_reshack.txt echo -modify string_table9.res,,, >>script_reshack.txt echo -modify string_table10.res,,, >>script_reshack.txt echo -modify string_table11.res,,, >>script_reshack.txt echo -modify string_table12.res,,, >>script_reshack.txt echo -modify string_table313.res,,, >>script_reshack.txt ResHacker.exe -script script_reshack.txt goto:eof


Or
if "%~1"=="" exit if "%~x1" NEQ ".exe" exit if exist "%~dp1%~n1_reshack.exe" del /F /Q "%~dp1%~n1_reshack.exe" goto write :write cd res echo [FILENAMES]>script_reshack.txt echo Exe="%~1">>script_reshack.txt echo SaveAs="%~dp1%~n1_reshack.exe">>script_reshack.txt echo [COMMANDS]>>script_reshack.txt echo -modify dialog.res, dialog,,0 >>script_reshack.txt echo -modify menu.res, MENU,,0 >>script_reshack.txt echo -modify string_table7.res, STRINGTABLE, 7,2057 >>script_reshack.txt echo -modify string_table8.res, STRINGTABLE, 8,2057 >>script_reshack.txt echo -modify string_table9.res, STRINGTABLE,9,2057 >>script_reshack.txt echo -modify string_table10.res, STRINGTABLE,10,2057 >>script_reshack.txt echo -modify string_table11.res, STRINGTABLE,11,2057 >>script_reshack.txt echo -modify string_table12.res, STRINGTABLE,12,2057 >>script_reshack.txt echo -modify string_table313.res, STRINGTABLE,313,2057 >>script_reshack.txt ResHacker.exe -script script_reshack.txt goto:eof

Should Work.

Edited by Mobius, 28 February 2012 - 12:20 AM.

AutoCamo Another Aut2Exe wrapper
*

#11 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 28 February 2012 - 12:03 AM

Post the exe file you are attempting to modify (if you have not packed or protected it there is absolutely no reason why you are failing to dump a res file to be modified).

Also if it is your program that you are modifying did you know that AutoItWrapper supports creating string table entrances using a simple directive plus an ini format file?

yes, is mine :oops:

I sent to you a PM

I don't like ini files to stringtables, and is always the same for all .exe, is just unpack, reshack, pack lol

Heroes, there is no such thing





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users