Jump to content
Sign in to follow this  
igorm

HEX edition

Recommended Posts

igorm

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.rar

So 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\

to

C:\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 :)

Share this post


Link to post
Share on other sites
fctd

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]

Share this post


Link to post
Share on other sites
fctd

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]

Share this post


Link to post
Share on other sites
Authenticity

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 by Authenticity

Share this post


Link to post
Share on other sites
smashly

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" ?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.