From 19f35f743cb6a7235270e88af655b714075f9b5d Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Thu, 26 Mar 2020 05:39:25 -0600 Subject: [PATCH] inject correctly in CLI --- GUI/host/host.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GUI/host/host.cpp b/GUI/host/host.cpp index cdcf0f2..83e25a8 100644 --- a/GUI/host/host.cpp +++ b/GUI/host/host.cpp @@ -1,5 +1,6 @@ #include "host.h" #include "defs.h" +#include "module.h" #include "hookcode.h" #include "../texthook/texthook.h" @@ -206,7 +207,7 @@ namespace Host IsWow64Process(process, &invalidProcess); if (invalidProcess) return AddConsoleOutput(NEED_32_BIT); #endif - static std::wstring location = std::filesystem::current_path().wstring() + L"\\" + ITH_DLL; + static std::wstring location = std::filesystem::path(GetModuleFilename().value()).replace_filename(ITH_DLL); if (LPVOID remoteData = VirtualAllocEx(process, nullptr, (location.size() + 1) * sizeof(wchar_t), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)) { WriteProcessMemory(process, remoteData, location.c_str(), (location.size() + 1) * sizeof(wchar_t), nullptr);