MCPcopy Create free account
hub / github.com/OpenSteam001/OpenSteamTool / ScanModule

Function ScanModule

src/Utils/SteamMetadata/PatternLoader.cpp:78–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78static void* ScanModule(OSTPlatform::DynamicLibrary::ModuleHandle module,
79 const std::vector<uint8_t>& bytes,
80 const std::vector<uint8_t>& mask)
81{
82 const auto image = OSTPlatform::Memory::GetModuleImage(module);
83 if (!image) return nullptr;
84
85 auto* base = image->base;
86 size_t size = image->size;
87 size_t patLen = bytes.size();
88 if (size < patLen) return nullptr;
89
90 for (size_t i = 0; i <= size - patLen; ++i) {
91 bool found = true;
92 for (size_t j = 0; j < patLen; ++j) {
93 if (mask[j] && base[i + j] != bytes[j]) { found = false; break; }
94 }
95 if (found) return base + i;
96 }
97 return nullptr;
98}
99
100// ---- TOML pattern parser ----
101

Callers 1

FindPatternFunction · 0.85

Calls 2

GetModuleImageFunction · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected