From f33bab4fb3586fd06896a7730bce8913c2616b78 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Thu, 2 Dec 2021 00:29:12 +0000 Subject: tier0 code cleanup and loadlibrary hook fix --- NorthstarDedicatedTest/hooks.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'NorthstarDedicatedTest/hooks.cpp') diff --git a/NorthstarDedicatedTest/hooks.cpp b/NorthstarDedicatedTest/hooks.cpp index 1b4bcc28..3de8d483 100644 --- a/NorthstarDedicatedTest/hooks.cpp +++ b/NorthstarDedicatedTest/hooks.cpp @@ -1,8 +1,6 @@ #include "pch.h" #include "hooks.h" #include "hookutils.h" -#include "dedicated.h" -#include "tier0.h" #include #include @@ -20,7 +18,7 @@ LoadLibraryExWType LoadLibraryExWOriginal; void InstallInitialHooks() { if (MH_Initialize() != MH_OK) - Error("MH_Initialize failed"); + spdlog::error("MH_Initialize failed"); HookEnabler hook; ENABLER_CREATEHOOK(hook, &LoadLibraryExA, &LoadLibraryExAHook, reinterpret_cast(&LoadLibraryExAOriginal)); @@ -75,7 +73,8 @@ HMODULE LoadLibraryExWHook(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) { for (auto& callbackStruct : dllLoadCallbacks) { - const wchar_t* callbackDll = std::wstring(callbackStruct->dll.begin(), callbackStruct->dll.end()).c_str(); + std::wstring wcharStrDll = std::wstring(callbackStruct->dll.begin(), callbackStruct->dll.end()); + const wchar_t* callbackDll = wcharStrDll.c_str(); if (!callbackStruct->called && wcsstr(lpLibFileName + (wcslen(lpLibFileName) - wcslen(callbackDll)), callbackDll) != nullptr) { callbackStruct->callback(moduleAddress); -- cgit v1.2.3