Merge pull request #289 from diamante0018/feature/no-hash-checks

Do not perform binary checks on the binary in debug
This commit is contained in:
Dss0 2022-06-03 22:07:49 +02:00 committed by GitHub
commit db51c06a12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -21,7 +21,7 @@
| `--copy-pdb` | Copy debug information for binaries as well to the path given via --copy-to. | | `--copy-pdb` | Copy debug information for binaries as well to the path given via --copy-to. |
| `--force-unit-tests` | Always compile unit tests. | | `--force-unit-tests` | Always compile unit tests. |
| `--force-exception-handler` | Install custom unhandled exception handler even for Debug builds. | | `--force-exception-handler` | Install custom unhandled exception handler even for Debug builds. |
| `--force-minidump-upload` | Upload minidumps even for Debug builds. | | `--disable-binary-check` | Do not perform integrity checks on the exe. |
| `--iw4x-zones` | Zonebuilder generates iw4x zones that cannot be loaded without IW4x specific patches. | | `--iw4x-zones` | Zonebuilder generates iw4x zones that cannot be loaded without IW4x specific patches. |
## Command line arguments ## Command line arguments

View File

@ -82,8 +82,8 @@ newoption {
} }
newoption { newoption {
trigger = "force-minidump-upload", trigger = "disable-binary-check",
description = "Upload minidumps even for Debug builds." description = "Do not perform integrity checks on the exe."
} }
newoption { newoption {
@ -262,12 +262,12 @@ workspace "iw4x"
if _OPTIONS["force-unit-tests"] then if _OPTIONS["force-unit-tests"] then
defines {"FORCE_UNIT_TESTS"} defines {"FORCE_UNIT_TESTS"}
end end
if _OPTIONS["force-minidump-upload"] then
defines {"FORCE_MINIDUMP_UPLOAD"}
end
if _OPTIONS["force-exception-handler"] then if _OPTIONS["force-exception-handler"] then
defines {"FORCE_EXCEPTION_HANDLER"} defines {"FORCE_EXCEPTION_HANDLER"}
end end
if _OPTIONS["disable-binary-check"] then
defines {"DISABLE_BINARY_CHECK"}
end
if _OPTIONS["iw4x-zones"] then if _OPTIONS["iw4x-zones"] then
defines {"GENERATE_IW4X_SPECIFIC_ZONES"} defines {"GENERATE_IW4X_SPECIFIC_ZONES"}
end end

View File

@ -54,6 +54,7 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*l
Steam::Proxy::RunMod(); Steam::Proxy::RunMod();
#ifndef DISABLE_BINARY_CHECK
// Ensure we're working with our desired binary // Ensure we're working with our desired binary
auto* _module = reinterpret_cast<char*>(0x400000); auto* _module = reinterpret_cast<char*>(0x400000);
auto hash1 = Utils::Cryptography::JenkinsOneAtATime::Compute(_module + 0x1000, 0x2D531F); // .text auto hash1 = Utils::Cryptography::JenkinsOneAtATime::Compute(_module + 0x1000, 0x2D531F); // .text
@ -69,6 +70,7 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*l
DWORD oldProtect; DWORD oldProtect;
VirtualProtect(_module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect); // Protect the .text segment VirtualProtect(_module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect); // Protect the .text segment
#endif
// 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();