From b0b40edd382028d506a4261344cbc7de3499a1fa Mon Sep 17 00:00:00 2001 From: acuifex <46835803+acuifex@users.noreply.github.com> Date: Thu, 27 Mar 2025 12:16:13 +0300 Subject: [PATCH] Pass module name to FindIatThunk --- polyhook2/PE/IatHook.hpp | 2 +- sources/IatHook.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/polyhook2/PE/IatHook.hpp b/polyhook2/PE/IatHook.hpp index 86e77167..c250a36b 100644 --- a/polyhook2/PE/IatHook.hpp +++ b/polyhook2/PE/IatHook.hpp @@ -27,7 +27,7 @@ class IatHook : public IHook { return HookType::IAT; } protected: - IMAGE_THUNK_DATA* FindIatThunk(const std::string& dllName, const std::string& apiName, const std::wstring moduleName = L""); + IMAGE_THUNK_DATA* FindIatThunk(const std::string& dllName, const std::string& apiName, const std::wstring& moduleName = L""); IMAGE_THUNK_DATA* FindIatThunkInModule(void* moduleBase, const std::string& dllName, const std::string& apiName); std::string m_dllName; diff --git a/sources/IatHook.cpp b/sources/IatHook.cpp index 3cbb4992..881cc802 100644 --- a/sources/IatHook.cpp +++ b/sources/IatHook.cpp @@ -15,7 +15,7 @@ PLH::IatHook::IatHook(const std::string& dllName, const std::string& apiName, co bool PLH::IatHook::hook() { assert(m_userOrigVar != nullptr); - IMAGE_THUNK_DATA* pThunk = FindIatThunk(m_dllName, m_apiName); + IMAGE_THUNK_DATA* pThunk = FindIatThunk(m_dllName, m_apiName, m_moduleName); if (pThunk == nullptr) return false; @@ -34,7 +34,7 @@ bool PLH::IatHook::unHook() { if (!m_hooked) return false; - IMAGE_THUNK_DATA* pThunk = FindIatThunk(m_dllName, m_apiName); + IMAGE_THUNK_DATA* pThunk = FindIatThunk(m_dllName, m_apiName, m_moduleName); if (pThunk == nullptr) return false; @@ -45,7 +45,7 @@ bool PLH::IatHook::unHook() { return true; } -IMAGE_THUNK_DATA* PLH::IatHook::FindIatThunk(const std::string& dllName, const std::string& apiName, const std::wstring moduleName /* = L"" */) { +IMAGE_THUNK_DATA* PLH::IatHook::FindIatThunk(const std::string& dllName, const std::string& apiName, const std::wstring& moduleName /* = L"" */) { #if defined(_WIN64) PEB* peb = (PPEB)__readgsqword(0x60); #else