Kyan Posted February 27, 2012 Posted February 27, 2012 (edited) 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 February 28, 2012 by DiOgO Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Mobius Posted February 27, 2012 Posted February 27, 2012 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
Kyan Posted February 27, 2012 Author Posted February 27, 2012 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 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 One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Mobius Posted February 27, 2012 Posted February 27, 2012 (edited) how I put all in a one res file?I used the GoRC.exe to convert them from .rc to .res and when you sayyou're saying do it like this: -modify string_table1.res ?To save all as res.1. Open your target exe with resourcehacker2. In the menu select File -> SaveAs3. In the 'Save File As' dialog where it says 'Save as type' click on the combo box4. Select 'Resource files (*.res)' then in the 'File name' field put say: MYRES.res5. 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 February 27, 2012 by Mobius
Kyan Posted February 27, 2012 Author Posted February 27, 2012 To save all as res.1. Open your target exe with resourcehacker2. In the menu select File -> SaveAs3. In the 'Save File As' dialog where it says 'Save as type' click on the combo box4. Select 'Resource files (*.res)' then in the 'File name' field put say: MYRES.res5. 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 One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Mobius Posted February 27, 2012 Posted February 27, 2012 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.
Kyan Posted February 27, 2012 Author Posted February 27, 2012 (edited) 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 numberEDIT: my reshacker version is 3.6.0.92 Edited February 27, 2012 by DiOgO Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Mobius Posted February 27, 2012 Posted February 27, 2012 (edited) 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 February 27, 2012 by Mobius
Kyan Posted February 27, 2012 Author Posted February 27, 2012 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 @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 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 One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Mobius Posted February 27, 2012 Posted February 27, 2012 (edited) 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"=="" exitif "%~x1" NEQ ".exe" exitif exist "%~dp1%~n1_reshack.exe" del /F /Q "%~dp1%~n1_reshack.exe"goto write:writecd resecho [FILENAMES]>script_reshack.txtecho Exe="%~1">>script_reshack.txtecho SaveAs="%~dp1%~n1_reshack.exe">>script_reshack.txtecho [COMMANDS]>>script_reshack.txtecho -modify dialog.res, dialog,,0 >>script_reshack.txtecho -modify menu.res, MENU,,0 >>script_reshack.txtecho -modify string_table7.res, STRINGTABLE, 7,0 >>script_reshack.txtecho -modify string_table8.res, STRINGTABLE, 8,0 >>script_reshack.txtecho -modify string_table9.res, STRINGTABLE,9,0 >>script_reshack.txtecho -modify string_table10.res, STRINGTABLE,10,0 >>script_reshack.txtecho -modify string_table11.res, STRINGTABLE,11,0 >>script_reshack.txtecho -modify string_table12.res, STRINGTABLE,12,0 >>script_reshack.txtecho -modify string_table313.res, STRINGTABLE,313,0 >>script_reshack.txtResHacker.exe -script script_reshack.txtgoto:eofKEY 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:eofOrif "%~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:eofShould Work. Edited February 28, 2012 by Mobius
Kyan Posted February 28, 2012 Author Posted February 28, 2012 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 I sent to you a PMI 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 One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now