From ce6127ae96022ce6e803a876a2e39eed7bd754ea Mon Sep 17 00:00:00 2001
From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com>
Date: Sun, 26 Dec 2021 05:22:33 +0000
Subject: fix potentially unsafe concommand
---
NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj | 2 ++
.../NorthstarDedicatedTest.vcxproj.filters | 6 ++++++
NorthstarDedicatedTest/dllmain.cpp | 2 ++
NorthstarDedicatedTest/miscserverfixes.cpp | 13 +++++++++++++
NorthstarDedicatedTest/miscserverfixes.h | 1 +
5 files changed, 24 insertions(+)
create mode 100644 NorthstarDedicatedTest/miscserverfixes.cpp
create mode 100644 NorthstarDedicatedTest/miscserverfixes.h
diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
index c684b69d..29dea6dc 100644
--- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
+++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
@@ -579,6 +579,7 @@
+
@@ -614,6 +615,7 @@
+
diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
index 7c856ea1..306ac763 100644
--- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
+++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
@@ -1386,6 +1386,9 @@
Header Files\include\openssl\internal
+
+ Header Files\Server
+
@@ -1493,6 +1496,9 @@
Source Files\Client
+
+ Source Files\Server
+
diff --git a/NorthstarDedicatedTest/dllmain.cpp b/NorthstarDedicatedTest/dllmain.cpp
index 212b5711..78edb297 100644
--- a/NorthstarDedicatedTest/dllmain.cpp
+++ b/NorthstarDedicatedTest/dllmain.cpp
@@ -24,6 +24,7 @@
#include "scriptbrowserhooks.h"
#include "scriptmainmenupromos.h"
#include "miscclientfixes.h"
+#include "miscserverfixes.h"
#include "memalloc.h"
bool initialised = false;
@@ -110,6 +111,7 @@ void InitialiseNorthstar()
AddDllLoadCallback("engine.dll", InitialiseServerAuthentication);
AddDllLoadCallback("engine.dll", InitialiseSharedMasterServer);
AddDllLoadCallback("server.dll", InitialiseMiscServerScriptCommand);
+ AddDllLoadCallback("server.dll", InitialiseMiscServerFixes);
AddDllLoadCallback("engine.dll", InitialisePlaylistHooks);
diff --git a/NorthstarDedicatedTest/miscserverfixes.cpp b/NorthstarDedicatedTest/miscserverfixes.cpp
new file mode 100644
index 00000000..2007a30c
--- /dev/null
+++ b/NorthstarDedicatedTest/miscserverfixes.cpp
@@ -0,0 +1,13 @@
+#include "pch.h"
+#include "miscserverfixes.h"
+#include "hookutils.h"
+
+void InitialiseMiscServerFixes(HMODULE baseAddress)
+{
+ // ret at the start of the concommand GenerateObjFile as it can crash servers
+ {
+ void* ptr = (char*)baseAddress + 0x38D920;
+ TempReadWrite rw(ptr);
+ *((char*)ptr) = (char)0xC3;
+ }
+}
\ No newline at end of file
diff --git a/NorthstarDedicatedTest/miscserverfixes.h b/NorthstarDedicatedTest/miscserverfixes.h
new file mode 100644
index 00000000..d1c05a6b
--- /dev/null
+++ b/NorthstarDedicatedTest/miscserverfixes.h
@@ -0,0 +1 @@
+void InitialiseMiscServerFixes(HMODULE baseAddress);
\ No newline at end of file
--
cgit v1.2.3