From b0eeca5b3695adfe77c22fc05add531d22161c8e Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Wed, 12 Feb 2020 00:30:01 -0700 Subject: [PATCH] no more auto removing read hooks --- texthook/texthook.cc | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/texthook/texthook.cc b/texthook/texthook.cc index 272046a..9fdaa81 100644 --- a/texthook/texthook.cc +++ b/texthook/texthook.cc @@ -238,30 +238,14 @@ bool TextHook::InsertHookCode() void TextHook::Read() { BYTE buffer[TEXT_BUFFER_SIZE] = {}; - int changeCount = 0, dataLen = 1; + int dataLen = 1; __try { - while (WaitForSingleObject(readerEvent, 500) == WAIT_TIMEOUT) + while (WaitForSingleObject(readerEvent, 500) == WAIT_TIMEOUT) if (memcmp(buffer, location, dataLen) != 0) if (int currentLen = HookStrlen((BYTE*)location)) { - if (memcmp(buffer, location, dataLen) == 0) - { - changeCount = 0; - continue; - } - if (++changeCount > 10) - { - ConsoleOutput(GARBAGE_MEMORY); - Clear(); - break; - } - - if (int currentLen = HookStrlen((BYTE*)location)) - { - dataLen = min(currentLen, TEXT_BUFFER_SIZE); - memcpy(buffer, location, dataLen); - TextOutput({ GetCurrentProcessId(), address, 0, 0 }, buffer, dataLen); - } - else changeCount = 0; + dataLen = min(currentLen, TEXT_BUFFER_SIZE); + memcpy(buffer, location, dataLen); + TextOutput({ GetCurrentProcessId(), address, 0, 0 }, buffer, dataLen); } } __except (EXCEPTION_EXECUTE_HANDLER)