I'm not usually one to post on forums for help, but I've been searching for an answer to this little problem for about 2 days straight, and it's really killing me.
On the day before I began to search, I used a hex editor to replace "00 00 00 01 00" in a file with "00 00 00 00 00", the amount of times, depends on the size of a file.
What I'm trying to do is automate this process. But I have no idea how to do it. I've never really worked with binary/hex in VB. But I've noticed that leading zeros is a big issue and that I have to pad the value.
Here's what I have so far;
Sub FindRplace(Filename As String, Filename2 As String)
Dim sBuffer As String
Dim ff As Integer
ff = FreeFile
Open Filename For Binary As #ff
sBuffer = Space$(LOF(ff))
Get #ff, 1, sBuffer
Close #ff
sBuffer = Replace(sBuffer, "PK", "AK")
Text1.Text = sBuffer
Open Filename2 For Binary As #ff
Put #ff, , sBuffer
Close #ff
End Sub
This is a function that replaces "PK" with "AK", in filename1 and outputs it to filename2, but like I said, I don't want to replace a string, but because I'm using null "00", I can't anyway. So how would I go about doing this, I'm so stuck.
Question
AZXIRSTV
I'm not usually one to post on forums for help, but I've been searching for an answer to this little problem for about 2 days straight, and it's really killing me.
On the day before I began to search, I used a hex editor to replace "00 00 00 01 00" in a file with "00 00 00 00 00", the amount of times, depends on the size of a file.
What I'm trying to do is automate this process. But I have no idea how to do it. I've never really worked with binary/hex in VB. But I've noticed that leading zeros is a big issue and that I have to pad the value.
Here's what I have so far;
This is a function that replaces "PK" with "AK", in filename1 and outputs it to filename2, but like I said, I don't want to replace a string, but because I'm using null "00", I can't anyway. So how would I go about doing this, I'm so stuck.
I'd be very grateful for any help.
Link to comment
Share on other sites
0 answers to this question
Recommended Posts