Jump to content

can i hex edit a dll in autoit?


Recommended Posts

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

:D

and proud of it!!!
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

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

:D

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

ok, this turned out to be better then i thought :D

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 adjustments

and a GUI attached to it.

@weaponX, you are credited ofcourse man.

See here for release

And your on the GUI too man :D

if you dont like that let me know ok?

it's only fair that you are included man :)

damian666

Edited by damian666
and proud of it!!!
Link to comment
Share on other sites

ok, this turned out to be better then i thought :D

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 adjustments

and a GUI attached to it.

@weaponX, you are credited ofcourse man.

See here for release

And your on the GUI too man :D

if you dont like that let me know ok?

it's only fair that you are included man :)

damian666

It was mostly SmOke_N, I really just refined his code along with the tip from Skinny.

Link to comment
Share on other sites

Look here

EDIT: Original posts has been deleted (by Larry) so here are my old original scripts

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.

Link to comment
Share on other sites

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 by Zedna
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...