C++ searching through memory for a binary sequence that match a pattern

  arrays, c++, memory, pattern-matching, regex

I’m sure this question has already been asked and solved somewhere, but I actually didn’t really find anything that works for me.

I’m trying to write a DLL which needs to find something in the .text section of an application. I think I can manage locating the .text section which contains what I want, so I think from that, I should be able to get a byte array (unsigned char *?) containing the whole .text section (?)

Now, since there are pointers everywhere, I figured I needed to use a regular expression to ignore certain bytes that might change depending on the version of the application.

So what would be the best way to find my pattern?
An example of such pattern:
"48 8d ?? ?? ?? ?? ?? e8"

Source: Windows Questions C++

LEAVE A COMMENT