Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Memory
- {
- bool compare(const uint8_t* pData, const uint8_t* bMask, const char* sMask)
- {
- for (; *sMask; ++sMask, ++pData, ++bMask)
- if (*sMask == 'x' && *pData != *bMask)
- return false;
- return *sMask == NULL;
- }
- intptr_t findPattern(const char* bMask, const char* sMask)
- {
- // Game Base & Size
- static intptr_t pGameBase = (intptr_t)GetModuleHandle(nullptr);
- static uint32_t pGameSize = 0;
- if (!pGameSize)
- {
- MODULEINFO info;
- GetModuleInformation(GetCurrentProcess(), (HMODULE)pGameBase, &info, sizeof(MODULEINFO));
- pGameSize = info.SizeOfImage;
- }
- // Scan
- for (uint32_t i = 0; i < pGameSize; i++)
- if (compare((uint8_t*)(pGameBase + i), (uint8_t*)bMask, sMask))
- return pGameBase + i;
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement