scrap that dumb idea

This commit is contained in:
Akash Mozumdar 2019-06-10 15:06:43 -04:00
parent c808e7594d
commit 64eee8f049
5 changed files with 6 additions and 8 deletions

View File

@ -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
};

View File

@ -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

View File

@ -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
{

View File

@ -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)

View File

@ -26,7 +26,7 @@ public:
}; // Absolute address
bool Insert(HookParam hp, DWORD set_flag);
void Clear(bool markRemoved = false);
void Clear();
private:
void Read();