Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editing values in an exe file

Status
Not open for further replies.

xilemx

Programmer
May 13, 2003
1
FI
K, so i have this project where i need to edit Hexvalues in an .exe file.. i have got pretty far ^^ but i still have 1 problem..
I get it to serch for offsets and insert/replace the string there.. BUT!
However i need to edit alot of things in the .exe and the offsets might change..
Now i would need to get it to find a Hex string and replace it with another.. not using the offset.

Heres my code:

te Sub cmdApply_Click()
FileName = "Test.exe"
If FileName = "" Then Exit Sub

a = FreeFile
Open FileName For Binary As a
Dim MyValue As String
Dim lOffSet As Long
Dim iPos As Integer

MyValue = "2E0A00008945FC837DFC0075138B4D0C518B5508528B4DF8E88506"
lOffSet = &H11D0DE

For iPos = 1 To Len(MyValue) Step 2
Put a, lOffSet + (iPos \ 2), CByte("&H" & Mid$(MyValue, iPos, 2))
Next iPos
Close a
End Sub

Thanx, and you could send any examples to xilemx@tkukoulu.fi

~xilemx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top