[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();
|
||||
|
||||
// Ensure we're working with our desired binary
|
||||
char* module = reinterpret_cast<char*>(GetModuleHandle(nullptr));
|
||||
auto hash = Utils::Cryptography::JenkinsOneAtATime::Compute(module, 0x2D6000);
|
||||
if (hash != 0x1678FD9F)
|
||||
char* textSegment = reinterpret_cast<char*>(0x401000);
|
||||
auto hash = Utils::Cryptography::JenkinsOneAtATime::Compute(textSegment, 0x2D531F);
|
||||
if (hash != 0x54684DBE
|
||||
#ifdef DEBUG
|
||||
&& hash != 0x8AADE716
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -74,7 +78,7 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*l
|
||||
#endif
|
||||
|
||||
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
|
||||
Utils::Hook(0x6BAC0F, Main::EntryPoint, HOOK_JUMP).install()->quick();
|
||||
|
Loading…
Reference in New Issue
Block a user