From d961347a611a8f4e670430008f562cdb042ffdd9 Mon Sep 17 00:00:00 2001 From: Maya Date: Sun, 26 Jun 2022 22:16:50 +0200 Subject: Switch IsValveMod back to use a EnablerHook (#210) * Switch IsValveMod back to use a EnablerHook KHook version no worky * Formatting >:( --- NorthstarDedicatedTest/ExploitFixes.cpp | 13 ++++++++++++- NorthstarDedicatedTest/ExploitFixes.h | 3 ++- NorthstarDedicatedTest/dllmain.cpp | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/NorthstarDedicatedTest/ExploitFixes.cpp b/NorthstarDedicatedTest/ExploitFixes.cpp index 9abc6b66..44b62d55 100644 --- a/NorthstarDedicatedTest/ExploitFixes.cpp +++ b/NorthstarDedicatedTest/ExploitFixes.cpp @@ -272,7 +272,11 @@ INVALID_CMD: // this is HORRIBLE for security, because it means servers can run arbitrary concommands on clients // especially since we have script commands this could theoretically be awful #include "gameutils.h" -KHOOK(IsValveMod, ("engine.dll", "48 83 EC 28 48 8B 0D ? ? ? ? 48 8D 15 ? ? ? ? E8 ? ? ? ? 85 C0 74 63"), bool, __fastcall, ()) + +typedef void (*IsValveModType)(); +IsValveModType IsValveMod; + +bool IsValveModHook() { return !CommandLine()->CheckParm("-norestrictservercommands"); } @@ -511,4 +515,11 @@ void ExploitFixes::LoadCallback(HMODULE baseAddress) HookEnabler hook; ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x2a8a50, &GetEntByIndexHook, reinterpret_cast(&GetEntByIndex)); +} + +void ExploitFixes::LoadCallbackEngine(HMODULE baseAddress) +{ + spdlog::info("ExploitFixes::LoadCallbackEngine ..."); + HookEnabler hook; + ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x1C6360, &IsValveModHook, reinterpret_cast(&IsValveMod)); } \ No newline at end of file diff --git a/NorthstarDedicatedTest/ExploitFixes.h b/NorthstarDedicatedTest/ExploitFixes.h index 7a407a3d..1cafe758 100644 --- a/NorthstarDedicatedTest/ExploitFixes.h +++ b/NorthstarDedicatedTest/ExploitFixes.h @@ -6,4 +6,5 @@ namespace ExploitFixes { void LoadCallback(HMODULE unused); -} \ No newline at end of file + void LoadCallbackEngine(HMODULE baseAddress); +} // namespace ExploitFixes \ No newline at end of file diff --git a/NorthstarDedicatedTest/dllmain.cpp b/NorthstarDedicatedTest/dllmain.cpp index fc403e95..08081d78 100644 --- a/NorthstarDedicatedTest/dllmain.cpp +++ b/NorthstarDedicatedTest/dllmain.cpp @@ -287,6 +287,7 @@ bool InitialiseNorthstar() // activate exploit fixes AddDllLoadCallback("server.dll", ExploitFixes::LoadCallback); + AddDllLoadCallback("engine.dll", ExploitFixes::LoadCallbackEngine); // run callbacks for any libraries that are already loaded by now CallAllPendingDLLLoadCallbacks(); -- cgit v1.2.3