extra Newbie cheater
Reputation: 0
Joined: 29 May 2011 Posts: 10
|
Posted: Mon Jul 11, 2011 9:42 am Post subject: (delphi) read relative positon in binary |
|
|
hi all
i made a vb6 prog that search a string in binary then go forward few steps to another position then display this new position contents in text box
the code is 100% working
for example
all exe files contains this line "This program cannot be run in DOS mode"
the program search for the string "This program" and get the string position in the binary file
then go forward 18 steps then show "dos mode" in text box
the program contains one text box and one command button
this program is very useful to read variable strings by reference to fixed string
my question
can any one convert this code to delphi code ???? | Code: | Dim buffer As String
Dim File As String
Private Sub Command1_Click()
Dim position As Double
Dim intIndex As Double
Dim strByte As String
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
File = ("c:\autorun.exe")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Open File For Binary As #1
Do While Not EOF(1)
buffer = Space(3500000)
Get #1, , buffer
DoEvents
position = InStr(buffer, ("This program"))
Loop
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
For intIndex = (position + 28) To (position + 30) Step 1
Seek #1, intIndex
strByte = Input$(8, #1)
Next intIndex
Close #1
Text1.Text = strByte$
Me.Show
Close #1
End Sub |
|
|