aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-26 05:22:33 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-26 05:22:33 +0000
commitce6127ae96022ce6e803a876a2e39eed7bd754ea (patch)
tree606a902a6fc976c35da64d3a292ebac7e11fe62d
parent3296aeae3cc035cfc20b9c7da40f7c5690e92daa (diff)
downloadNorthstarLauncher-ce6127ae96022ce6e803a876a2e39eed7bd754ea.tar.gz
NorthstarLauncher-ce6127ae96022ce6e803a876a2e39eed7bd754ea.zip
fix potentially unsafe concommand
-rw-r--r--NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj2
-rw-r--r--NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters6
-rw-r--r--NorthstarDedicatedTest/dllmain.cpp2
-rw-r--r--NorthstarDedicatedTest/miscserverfixes.cpp13
-rw-r--r--NorthstarDedicatedTest/miscserverfixes.h1
5 files changed, 24 insertions, 0 deletions
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 @@
<ClInclude Include="memalloc.h" />
<ClInclude Include="miscclientfixes.h" />
<ClInclude Include="misccommands.h" />
+ <ClInclude Include="miscserverfixes.h" />
<ClInclude Include="modlocalisation.h" />
<ClInclude Include="modmanager.h" />
<ClInclude Include="pch.h" />
@@ -614,6 +615,7 @@
<ClCompile Include="memalloc.cpp" />
<ClCompile Include="miscclientfixes.cpp" />
<ClCompile Include="misccommands.cpp" />
+ <ClCompile Include="miscserverfixes.cpp" />
<ClCompile Include="modlocalisation.cpp" />
<ClCompile Include="logging.cpp" />
<ClCompile Include="masterserver.cpp" />
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 @@
<ClInclude Include="include\internal\unicode.h">
<Filter>Header Files\include\openssl\internal</Filter>
</ClInclude>
+ <ClInclude Include="miscserverfixes.h">
+ <Filter>Header Files\Server</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
@@ -1493,6 +1496,9 @@
<ClCompile Include="miscclientfixes.cpp">
<Filter>Source Files\Client</Filter>
</ClCompile>
+ <ClCompile Include="miscserverfixes.cpp">
+ <Filter>Source Files\Server</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="include\spdlog\fmt\bundled\LICENSE.rst">
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