[Main] Fix binary check
This commit is contained in:
parent
91fa299707
commit
6be5f2cd86
12
src/Main.cpp
12
src/Main.cpp
@ -55,9 +55,13 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*l
|
|||||||
Steam::Proxy::RunMod();
|
Steam::Proxy::RunMod();
|
||||||
|
|
||||||
// Ensure we're working with our desired binary
|
// Ensure we're working with our desired binary
|
||||||
char* module = reinterpret_cast<char*>(GetModuleHandle(nullptr));
|
char* textSegment = reinterpret_cast<char*>(0x401000);
|
||||||
auto hash = Utils::Cryptography::JenkinsOneAtATime::Compute(module, 0x2D6000);
|
auto hash = Utils::Cryptography::JenkinsOneAtATime::Compute(textSegment, 0x2D531F);
|
||||||
if (hash != 0x1678FD9F)
|
if (hash != 0x54684DBE
|
||||||
|
#ifdef DEBUG
|
||||||
|
&& hash != 0x8AADE716
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -74,7 +78,7 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*l
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
DWORD oldProtect;
|
DWORD oldProtect;
|
||||||
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect); // Protect the .text segment
|
VirtualProtect(textSegment, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect); // Protect the .text segment
|
||||||
|
|
||||||
// Install entry point hook
|
// Install entry point hook
|
||||||
Utils::Hook(0x6BAC0F, Main::EntryPoint, HOOK_JUMP).install()->quick();
|
Utils::Hook(0x6BAC0F, Main::EntryPoint, HOOK_JUMP).install()->quick();
|
||||||
|
Loading…
Reference in New Issue
Block a user