diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-12-02 00:29:12 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-12-02 00:29:12 +0000 |
commit | f33bab4fb3586fd06896a7730bce8913c2616b78 (patch) | |
tree | 484bc51055c9ad810fa4bfd1c0b1b0e35ae03096 /NorthstarDedicatedTest/hooks.cpp | |
parent | ac0c658516d8eaef2c788624f94e974ef47acbb8 (diff) | |
download | NorthstarLauncher-f33bab4fb3586fd06896a7730bce8913c2616b78.tar.gz NorthstarLauncher-f33bab4fb3586fd06896a7730bce8913c2616b78.zip |
tier0 code cleanup and loadlibrary hook fix
Diffstat (limited to 'NorthstarDedicatedTest/hooks.cpp')
-rw-r--r-- | NorthstarDedicatedTest/hooks.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
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 <wchar.h> #include <iostream> @@ -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<LPVOID*>(&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); |