damian666 Posted April 25, 2008 Author Posted April 25, 2008 Why not just write to the file through binary then... psuedo codeCODE: AutoIt$hFile = FileOpen(File, 16+2) $var = FileRead(File) $strbin = StringToBinary($var) $strrep = StringReplace($strbin, "81EC88000000A118", "33F68BC6C9C20800") $binstr = BinaryToString($strrep) FileWrite(File, $binstr) FileClose($hFile) leaves me with a empty file man and proud of it!!!
weaponx Posted April 25, 2008 Posted April 25, 2008 This code works for me: $infile = "uxtheme.dll" $outfile = "test.dll" ;Open original file read only $hIn = FileOpen($infile, 16) ;Read in contents $var = FileRead($hIn) ;Close handle to original file FileClose($hIn) ;Perform replacement $var = StringReplace($var, "81EC88000000A118", "33F68BC6C9C20800") If @ERROR Then MsgBox(0,"","Match not found") Else ;Open handle to output file $hOut = FileOpen($outfile, 16+2) ;Write to output file FileWrite($hOut , $var) ;Close handle to output file FileClose($hOut) EndIf
Moderators SmOke_N Posted April 25, 2008 Moderators Posted April 25, 2008 Why not just write to the file through binary then... psuedo codeCODE: AutoIt$hFile = FileOpen(File, 16+2)$var = FileRead(File)$strbin = StringToBinary($var)$strrep = StringReplace($strbin, "81EC88000000A118", "33F68BC6C9C20800")$binstr = BinaryToString($strrep)FileWrite(File, $binstr)FileClose($hFile)leaves me with a empty file man I said it was pseudo... why wouldn't you look in the help file to see what each function did and what the calls were... obviously 16 + 2 erases the previous content... Seems weaponx ran with it and provided you with a working example. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
weaponx Posted April 25, 2008 Posted April 25, 2008 I said it was pseudo... why wouldn't you look in the help file to see what each function did and what the calls were... obviously 16 + 2 erases the previous content... Seems weaponx ran with it and provided you with a working example.Alley oop?
damian666 Posted April 25, 2008 Author Posted April 25, 2008 @smoke, oops... didnt see that, overlooked it man, sorry... @weaponX, thanx for the help man, i really appriciate it. to all you guys, thanx!!! damian666 and proud of it!!!
damian666 Posted April 25, 2008 Author Posted April 25, 2008 (edited) ok, this turned out to be better then i thought so i decide to make it a public project.not the source, but the release.there is not much source btw, it is mainly the function that WeaponX gave me, with some little adjustmentsand a GUI attached to it.@weaponX, you are credited ofcourse man.See here for releaseAnd your on the GUI too man if you dont like that let me know ok?it's only fair that you are included man damian666 Edited April 25, 2008 by damian666 and proud of it!!!
weaponx Posted April 26, 2008 Posted April 26, 2008 ok, this turned out to be better then i thought so i decide to make it a public project.not the source, but the release.there is not much source btw, it is mainly the function that WeaponX gave me, with some little adjustmentsand a GUI attached to it.@weaponX, you are credited ofcourse man.See here for releaseAnd your on the GUI too man if you dont like that let me know ok?it's only fair that you are included man damian666It was mostly SmOke_N, I really just refined his code along with the tip from Skinny.
damian666 Posted April 26, 2008 Author Posted April 26, 2008 ok, then i will change the credits to the autoit community ok? that way i have tham all!!! thanx again man Damian666 and proud of it!!!
unknown12 Posted April 27, 2008 Posted April 27, 2008 Look hereEDIT: Original posts has been deleted (by Larry) so here are my old original scriptsHi, do you have an english explanation of how to use your script? I tried using a Czech online translator to translate the message box, but it didn't work very well.Thanks.
Zedna Posted April 27, 2008 Posted April 27, 2008 (edited) Hi, do you have an english explanation of how to use your script? I tried using a Czech online translator to translate the message box, but it didn't work very well. Thanks. I will post translated version soon. Stay tuned ... Here is translated only Help() function Func Help() MsgBox(0,"Help", _ 'PATCH 1.0 - program to make/test patch' & @CRLF & _ '' & @CRLF & _ 'input parametres:' & @CRLF & _ '- command what to do /K test or /P patch or /Z undo' & @CRLF & _ '- name of file to be patched' & @CRLF & _ '' & @CRLF & _ 'also must exist TXT file of the same name like file to be patched' & @CRLF & _ 'with list of adresses and values in this form (compatible with output from FC.EXE):' & @CRLF & _ 'hexa position1: orig. hexa value1 new hexa value1' & @CRLF & _ 'hexa position2: orig. hexa value2 new hexa value2' & @CRLF & _ '...' & @CRLF & _ 'hexa positionN: orig. hexa valueN new hexa valueN' & @CRLF & _ '' & @CRLF & _ 'examples:' & @CRLF & _ '1) patch /K test.exe' & @CRLF & _ '2) patch /P test.exe' & @CRLF & _ '3) patch /Z test.exe' & @CRLF & _ '' & @CRLF & _ 'test.txt:' & @CRLF & _ '00000073: 65 FC' & @CRLF & _ '001B4FE8: 24 40' & @CRLF & _ '' & @CRLF & _ 'command /Z undo will do reverse patch, from new value to old one') EndFunc Edited April 27, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Zedna Posted April 29, 2008 Posted April 29, 2008 (edited) Here is translated english version. Unfortunatelly it's not working with latest 3.2.10 AutoIt version. Compile is OK but at runtime it show error when opening file.PATCH_eng.AU3 Edited April 29, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
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