igorm Posted January 22, 2009 Share Posted January 22, 2009 Hi,I'm trying to HEX edit some files, but it seems that I can not figure how to do it. I tried using function here but I couldn't achieve what I wanted. Here is a file which I'm trying to edit.RESTORE.rarSo I need to change all paths in file to some other path. For example I want to change:C:\Program Files\Nero\Nero 9\Nero Express\toC:\Program Files\Nero\Nero 9\Nero BurningROM\So, this should be some partial search which will find and replace parts of path. Some function that could do this would be great. Thanks in advance for any help.Cheers Office 2000/XP/2003/2007 Slipstreamer Link to comment Share on other sites More sharing options...
fctd Posted January 22, 2009 Share Posted January 22, 2009 It's not nice, but try if this will work. I don't know, if it will keep the file intact. #Include <File.au3> $sFileName = "C:\...\RESTORE.DB" $sTempName = "C:\...\RESTORE.txt" $sSearchString = "C:\Program Files\Nero\Nero 9\Nero Express\" $sReplaceString = "C:\Program Files\Nero\Nero 9\Nero BurningROM\" $sFileCreate = "C:\...\restore_test.txt" FileCopy ($sFileName, $sTempName) FileDelete ($sFileName) $h = FileOpen( $sTempName , 16) $sFile = FileRead($h) $string = BinaryToString ($sFile) $sNewString = StringReplace($string,$sSearchString,$sReplaceString) FileClose($h) FileDelete ($sTempName) _FileCreate($sFileCreate) $h2 = FileOpen($sFileCreate,18) FileWrite($h2 , $sNewString) FileClose($h2) FileCopy ($sFileCreate, $sFileName) FileDelete ($sFileCreate) Greetings. [list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font] Link to comment Share on other sites More sharing options...
igorm Posted January 22, 2009 Author Share Posted January 22, 2009 Thanks, I'll try this, but I think it won't work if lenght of the replacement string is not the same. Any other idea? Thanks. Cheers Office 2000/XP/2003/2007 Slipstreamer Link to comment Share on other sites More sharing options...
fctd Posted January 22, 2009 Share Posted January 22, 2009 Well, this was my result. RESTORE_.rar Don't know if the file is still working for your application. Greetings. [list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font] Link to comment Share on other sites More sharing options...
igorm Posted January 24, 2009 Author Share Posted January 24, 2009 Well, this was my result. RESTORE_.rar Don't know if the file is still working for your application. Greetings. Yeah, that's the problem. Application will not work, that's why it needs to be HEX edited. I'm really stuck here... Cheers Office 2000/XP/2003/2007 Slipstreamer Link to comment Share on other sites More sharing options...
Authenticity Posted January 24, 2009 Share Posted January 24, 2009 (edited) This is not logically applicable because in many file format there might be section header which tells how big in bytes this section is and some offset for specific location within the section... If you write the same amount of bytes or less but don't append bytes you should have no problem doing so but even one byte appending and the file format might be corrupted... This kind of things usually made by hand or by a program that know the file format's structure exactly and how it'll not corrupt it. For example in Diablo II I've used program to give items or attributes to my character in an automatic way which in the end make a CRC32 check and replace the 0x12 offset dword with the new one and the file size and section count of items and whole file size ^^ think of it as analyzing the file format =] Edited January 24, 2009 by Authenticity Link to comment Share on other sites More sharing options...
smashly Posted January 25, 2009 Share Posted January 25, 2009 Since the file your trying to edit is a SQL v3 database file, have you tried using the SQLite Management functions found in Autoit's help file under "User Defined Functions -> SQLite Management" ? Link to comment Share on other sites More sharing options...
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