Jump to content

How To: Change a Textstring in a .exe / .dll?


Mica
 Share

Recommended Posts

Hello all,

i'm really starting with this, and i was wondering if i'd be able to open a .exe / .dll file and then replace a text-string in it?

I tried it with _ReplaceStringInFile() but it just deleted all the content and leaves about 3bytes left in the file.

i've searched for hex editing but can't figure out how to find the position of the textscring with hex editor. Any way to find this, and could someone explain abit how to do this or even write a small example script?

Thanks in advance.

Link to comment
Share on other sites

Welcome to the AutoIt forums Mica :)

This sort of approach might work, assuming Ansi strings

$SFile = "somefile.dll"
$b = fileread($sFile)
$s=stringreplace($b,"DeleteCriticalSection","DelopeCrontifulMOgbust")
$hf = fileopen($SFile,2+16);replace existing and force binary mode
filewrite($hf,$s)
fileclose($hf)

If you try to write a string back to the file, without setting binary mode, then only 3 characters will be written because a byte with a value of zero represents the end of a string and exe's and dll's start with hex values

45, 5A, 50,00

or

45,5A, 90,00

for example.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...