MCPcopy Create free account
hub / github.com/PenguLoader/PenguLoader / scan_memory_pattern

Function scan_memory_pattern

core/src/utils/dylib.cc:56–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56static void *scan_memory_pattern(void *data, size_t length, const std::vector<int> &pattern)
57{
58 size_t pattern_size = pattern.size();
59 auto patern_bytes = pattern.data();
60
61 size_t find_size = length - pattern_size;
62 auto scan_bytes = reinterpret_cast<uint8_t *>(data);
63
64 for (size_t i = 0; i < find_size; ++i)
65 {
66 for (size_t j = 0; j < pattern_size; ++j)
67 if (scan_bytes[i + j] != patern_bytes[j] && patern_bytes[j] != -1)
68 goto next;
69 return scan_bytes + i;
70 next:;
71 }
72
73 return nullptr;
74}
75
76static void *scan_memory_bytes(void *data, size_t length, const std::vector<int> &find_bytes)
77{

Callers 1

find_memoryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected