aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaya <malte.hoermeyer@web.de>2022-06-26 22:16:50 +0200
committerGitHub <noreply@github.com>2022-06-26 22:16:50 +0200
commitd961347a611a8f4e670430008f562cdb042ffdd9 (patch)
tree138bf9fbd524f954dd7e8517e9434f5f4d91783c
parent660062b934ac98077f08fde9a18f795be0b58b0f (diff)
downloadNorthstarLauncher-d961347a611a8f4e670430008f562cdb042ffdd9.tar.gz
NorthstarLauncher-d961347a611a8f4e670430008f562cdb042ffdd9.zip
Switch IsValveMod back to use a EnablerHook (#210)
* Switch IsValveMod back to use a EnablerHook KHook version no worky * Formatting >:(
-rw-r--r--NorthstarDedicatedTest/ExploitFixes.cpp13
-rw-r--r--NorthstarDedicatedTest/ExploitFixes.h3
-rw-r--r--NorthstarDedicatedTest/dllmain.cpp1
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<LPVOID*>(&GetEntByIndex));
+}
+
+void ExploitFixes::LoadCallbackEngine(HMODULE baseAddress)
+{
+ spdlog::info("ExploitFixes::LoadCallbackEngine ...");
+ HookEnabler hook;
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x1C6360, &IsValveModHook, reinterpret_cast<LPVOID*>(&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();