From 64eee8f049a3057d161d0f6d859f5e47630263f5 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Mon, 10 Jun 2019 15:06:43 -0400 Subject: [PATCH] scrap that dumb idea --- include/const.h | 1 - texthook/main.cc | 6 +++--- texthook/main.h | 2 +- texthook/texthook.cc | 3 +-- texthook/texthook.h | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/const.h b/include/const.h index 3b419b4..16fc358 100644 --- a/include/const.h +++ b/include/const.h @@ -28,5 +28,4 @@ enum HookParamType : unsigned DIRECT_READ = 0x2000, // /R read code instead of classic /H hook code HOOK_ENGINE = 0x4000, HOOK_ADDITIONAL = 0x8000, - HOOK_REMOVED = 0x10000, // hook was intentionally removed by the user }; diff --git a/texthook/main.cc b/texthook/main.cc index 2c05799..e3bc567 100644 --- a/texthook/main.cc +++ b/texthook/main.cc @@ -68,7 +68,7 @@ DWORD WINAPI Pipe(LPVOID) case HOST_COMMAND_REMOVE_HOOK: { auto info = *(RemoveHookCmd*)buffer; - RemoveHook(info.address, 0, true); + RemoveHook(info.address, 0); } break; case HOST_COMMAND_FIND_HOOK: @@ -196,9 +196,9 @@ void NewHook(HookParam hp, LPCSTR lpname, DWORD flag) } } -void RemoveHook(uint64_t addr, int maxOffset, bool markRemoved) +void RemoveHook(uint64_t addr, int maxOffset) { - for (auto& hook : *hooks) if (abs((long long)(hook.address - addr)) <= maxOffset) return hook.Clear(markRemoved); + for (auto& hook : *hooks) if (abs((long long)(hook.address - addr)) <= maxOffset) return hook.Clear(); } // EOF diff --git a/texthook/main.h b/texthook/main.h index a4f86ed..6e07e60 100644 --- a/texthook/main.h +++ b/texthook/main.h @@ -12,7 +12,7 @@ void ConsoleOutput(LPCSTR text, ...); void NotifyHookFound(HookParam hp, wchar_t* text); void NotifyHookRemove(uint64_t addr, LPCSTR name); void NewHook(HookParam hp, LPCSTR name, DWORD flag = HOOK_ENGINE); -void RemoveHook(uint64_t addr, int maxOffset = 9, bool markRemoved = false); +void RemoveHook(uint64_t addr, int maxOffset = 9); extern "C" // minhook library { diff --git a/texthook/texthook.cc b/texthook/texthook.cc index b0d68ac..c261062 100644 --- a/texthook/texthook.cc +++ b/texthook/texthook.cc @@ -283,7 +283,7 @@ void TextHook::RemoveReadCode() CloseHandle(readerThread); } -void TextHook::Clear(bool markRemoved) +void TextHook::Clear() { std::scoped_lock lock(viewMutex); if (address == 0) return; @@ -291,7 +291,6 @@ void TextHook::Clear(bool markRemoved) else RemoveHookCode(); NotifyHookRemove(address, hp.name); memset(this, 0, sizeof(TextHook)); // jichi 11/30/2013: This is the original code of ITH - if (markRemoved) hp.type = HOOK_REMOVED; } int TextHook::GetLength(uintptr_t base, uintptr_t in) diff --git a/texthook/texthook.h b/texthook/texthook.h index 885f71f..c286099 100644 --- a/texthook/texthook.h +++ b/texthook/texthook.h @@ -26,7 +26,7 @@ public: }; // Absolute address bool Insert(HookParam hp, DWORD set_flag); - void Clear(bool markRemoved = false); + void Clear(); private: void Read();