FileRead & binary data Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
newbieforever
Posts: 197
Joined: 24 Aug 2016, 03:34

FileRead & binary data

22 May 2018, 01:30

I would like to use FileRead, Str, c* MyFile.exeto read the content of an exe file, and then replace all binary null characters by @ to have an readable Str which I can use for further processing. How this replacing could be done?
User avatar
jeeswg
Posts: 4508
Joined: 19 Dec 2016, 01:58
Location: UK

Re: FileRead & binary data

22 May 2018, 23:56

- Some ideas are:
- Loop through each byte using NumGet, use NumPut on any null bytes.
- Binary data to hex string, edit hex string (use RegEx to put a separator character between every pair of hex digits, replace any 00s, remove the separator character), hex string to binary data.
- Write a machine code function to search for null characters and replace them using NumPut.
InBuf function currently 32-bit only (machine code binary buffer searching) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=28393
- Write a machine code function to replace null characters with a specified character.
- (Then, for all of the approaches, to finish, use StrGet to retrieve an ANSI string.)

- Here's an example to loop through each byte using NumGet, and use NumPut on any null bytes.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
nnnik
Posts: 2908
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: FileRead & binary data

23 May 2018, 00:20

newbieforever wrote:I would like to use FileRead, Str, c* MyFile.exeto read the content of an exe file, and then replace all binary null characters by @ to have an readable Str which I can use for further processing. How this replacing could be done?

I think it might be worth mentioning that you wont get a working string after you have done this.
Depending on your encoding you still need to do several different things.
I would not reccomend doing this.
Recommends AHK Studio
newbieforever
Posts: 197
Joined: 24 Aug 2016, 03:34

Re: FileRead & binary data  Topic is solved

23 May 2018, 01:22

I am using now this:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Return to “Ask For Help”

Who is online

Users browsing this forum: Flipeador, tyyi, Xtra and 11 guests