From 524dd4b205e5d75ae73d7a7505e2b5551fed78c5 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Fri, 6 May 2016 22:33:49 -0400 Subject: [PATCH] Added a way to disable the memPatch function for those worried about T2 ROP being used with memPatch --- .../TSExtension/TSExtension/include/DXConCmds.h | 2 ++ .../TSExtension/TSExtension/source/DXConCmds.cpp | 13 +++++++++++++ .../TSExtension/TSExtension/source/dllmain.cpp | 2 ++ 3 files changed, 17 insertions(+) diff --git a/Mod Sources/TSExtension/TSExtension/include/DXConCmds.h b/Mod Sources/TSExtension/TSExtension/include/DXConCmds.h index 3df8b98..20cc92e 100644 --- a/Mod Sources/TSExtension/TSExtension/include/DXConCmds.h +++ b/Mod Sources/TSExtension/TSExtension/include/DXConCmds.h @@ -68,6 +68,8 @@ bool conForceUpdate(Linker::SimObject *obj, S32 argc, const char* argv[]); // General Commands --------------------------------- const char* conSprintf(Linker::SimObject *obj, S32 argc, const char* argv[]); bool conTSExtensionUpdate(Linker::SimObject *obj, S32 argc, const char *argv[]); +// memPatch Disabler ------------------------------- +bool disableMempatch(Linker::SimObject* obj, S32 argc, const char* argv[]); // Regex Commands ---------------------------------- const char* reIterNext(Linker::SimObject* obj, S32 argc, const char* argv[]); bool reIterEnd(Linker::SimObject* obj, S32 argc, const char* argv[]); diff --git a/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp b/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp index 69c71e6..209c60b 100644 --- a/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp @@ -377,6 +377,19 @@ const char* conSprintf(Linker::SimObject *obj, S32 argc, const char* argv[]) return result; } +// memPatch Disabler +bool memPatchStub(Linker::SimObject* obj, S32 argc, const char* argv[]) +{ + Con::errorf(0, "TSExtension: Attempted usage of memPatch after disabling it!"); + return false; +} + +bool disableMempatch(Linker::SimObject* obj, S32 argc, const char* argv[]) +{ + Con::addMethodB(NULL, "memPatch", &memPatchStub,"Currently not available.", 1, 1); + return true; +} + // RE Commands ----------------------------------- #include diff --git a/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp b/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp index d638670..0d870a3 100644 --- a/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp @@ -459,6 +459,8 @@ __declspec(naked) void updateMoveHook() // General Con::addMethodS(NULL, "sprintf", &conSprintf,"Formats a string. See the C sprintf.", 2, 20); Con::addMethodB(NULL, "tsExtensionUpdate", &conTSExtensionUpdate,"Updates the TSExtension.", 1, 1); + // memPatch Disabler + Con::addMethodB(NULL, "disableMempatch", &disableMempatch,"Disables memPatch.", 1, 1); // Regex Con::addMethodB(NULL, "reSearch", &reSearch,"reSearch(pattern, target): Searches for a pattern within the target string.", 3, 3); Con::addMethodB(NULL, "reMatch", &reMatch,"reMatch(pattern, target): Attempts to match the entire target string to a pattern.", 3, 3);