aboutsummaryrefslogtreecommitdiff
path: root/loader_wsock32_proxy/hookutils.cpp
diff options
context:
space:
mode:
authorBobTheBob9 <for.oliver.kirkham@gmail.com>2022-07-10 22:21:29 +0100
committerBobTheBob9 <for.oliver.kirkham@gmail.com>2022-07-10 22:21:29 +0100
commit0a9a44ce15bb772b3193fbee481768e7327db1a9 (patch)
tree855b235161de35ade7d86ce2d847483aa46b31e4 /loader_wsock32_proxy/hookutils.cpp
parent2ae34b67e36b8ba05132d481876eb4ed7a826283 (diff)
downloadNorthstarLauncher-0a9a44ce15bb772b3193fbee481768e7327db1a9.tar.gz
NorthstarLauncher-0a9a44ce15bb772b3193fbee481768e7327db1a9.zip
completely remove old hooking
Diffstat (limited to 'loader_wsock32_proxy/hookutils.cpp')
-rw-r--r--loader_wsock32_proxy/hookutils.cpp54
1 files changed, 0 insertions, 54 deletions
diff --git a/loader_wsock32_proxy/hookutils.cpp b/loader_wsock32_proxy/hookutils.cpp
deleted file mode 100644
index 7792a78e..00000000
--- a/loader_wsock32_proxy/hookutils.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#include "pch.h"
-#include "../NorthstarDLL/hookutils.h"
-
-#define ERROR(...) { char err[2048]; sprintf_s(err, __VA_ARGS__); MessageBoxA(GetForegroundWindow(), err, "Northstar Wsock32 Proxy Error", 0); }
-
-void HookEnabler::CreateHook(LPVOID ppTarget, LPVOID ppDetour, LPVOID* ppOriginal, const char* targetName)
-{
- // the macro for this uses ppTarget's name as targetName, and this typically starts with &
- // targetname is used for debug stuff and debug output is nicer if we don't have this
- if (*targetName == '&')
- targetName++;
-
- if (MH_CreateHook(ppTarget, ppDetour, ppOriginal) == MH_OK)
- {
- HookTarget* target = new HookTarget;
- target->targetAddress = ppTarget;
- target->targetName = (char*)targetName;
-
- m_hookTargets.push_back(target);
- }
- else
- {
- if (targetName != nullptr)
- {
- ERROR("MH_CreateHook failed for function %s", targetName);
- }
- else
- {
- ERROR("MH_CreateHook failed for unknown function");
- }
- }
-}
-
-HookEnabler::~HookEnabler()
-{
- for (auto& hook : m_hookTargets)
- {
- if (MH_EnableHook(hook->targetAddress) != MH_OK)
- {
- if (hook->targetName != nullptr)
- {
- ERROR("MH_EnableHook failed for function %s", hook->targetName);
- }
- else
- {
- ERROR("MH_EnableHook failed for unknown function");
- }
- }
- else
- {
- //ERROR("Enabling hook %s", hook->targetName);
- }
- }
-} \ No newline at end of file