bugfix read code

This commit is contained in:
Akash Mozumdar 2018-08-20 11:15:48 -04:00
parent 2f09b534d2
commit 4e10a597c9

View File

@ -448,18 +448,17 @@ DWORD WINAPI ReaderThread(LPVOID threadParam)
{ {
TextHook* hook = (TextHook*)threadParam; TextHook* hook = (TextHook*)threadParam;
BYTE buffer[PIPE_BUFFER_SIZE] = {}; BYTE buffer[PIPE_BUFFER_SIZE] = {};
char testChar = 0; char testChar1 = 0, testChar2 = 0; // Artikash 8/20/2018: two testChars in case the first character of the string is the same
unsigned int changeCount = 0; unsigned int changeCount = 0;
const char* currentAddress = (char*)hook->hp.address; const char* currentAddress = (char*)hook->hp.address;
while (true) while (true)
{ {
Sleep(1000); Sleep(1000);
if (testChar == *currentAddress) if (testChar1 == *currentAddress && testChar2 == *(currentAddress + 3))
{ {
changeCount = 0; changeCount = 0;
continue; continue;
} }
testChar = *currentAddress;
if (++changeCount > 10) if (++changeCount > 10)
{ {
ConsoleOutput("NextHooker: memory constantly changing, useless to read"); ConsoleOutput("NextHooker: memory constantly changing, useless to read");
@ -480,9 +479,8 @@ DWORD WINAPI ReaderThread(LPVOID threadParam)
DWORD unused; DWORD unused;
WriteFile(::hookPipe, buffer, dataLen + HEADER_SIZE, &unused, nullptr); WriteFile(::hookPipe, buffer, dataLen + HEADER_SIZE, &unused, nullptr);
if (hook->hp.offset == 0) continue; testChar1 = *currentAddress;
currentAddress += dataLen + hook->hp.offset; testChar2 = *(currentAddress + 3);
testChar = *currentAddress;
} }
hook->ClearHook(); hook->ClearHook();
return 0; return 0;