bugfixes
This commit is contained in:
parent
389db72dd2
commit
679317b5f5
@ -19,7 +19,7 @@ struct ProcessRecord
|
||||
|
||||
// Artikash 5/31/2018: required for unordered_map to work with struct key
|
||||
template <> struct std::hash<ThreadParam> { size_t operator()(const ThreadParam& tp) const { return std::hash<__int64>()((tp.pid + tp.hook) ^ (tp.retn + tp.spl)); } };
|
||||
bool operator==(const ThreadParam& one, const ThreadParam& two) { return memcmp(&one, &two, sizeof(ThreadParam)) == 0; }
|
||||
bool operator==(const ThreadParam& one, const ThreadParam& two) { return one.pid == two.pid && one.hook == two.hook && one.retn == two.retn && one.spl == two.spl; }
|
||||
|
||||
// Artikash 7/20/2018: similar to std::lock guard but use Winapi objects for cross process comms
|
||||
class MutexLocker
|
||||
|
@ -448,12 +448,12 @@ DWORD WINAPI ReaderThread(LPVOID threadParam)
|
||||
TextHook* hook = (TextHook*)threadParam;
|
||||
BYTE buffer[PIPE_BUFFER_SIZE] = {};
|
||||
unsigned int changeCount = 0;
|
||||
int dataLen = 1;
|
||||
int dataLen = 0;
|
||||
const char* currentAddress = (char*)hook->hp.address;
|
||||
while (true)
|
||||
{
|
||||
Sleep(500);
|
||||
if (memcmp(buffer + sizeof(ThreadParam), currentAddress, dataLen) == 0)
|
||||
if (memcmp(buffer + sizeof(ThreadParam), currentAddress, dataLen + 1) == 0)
|
||||
{
|
||||
changeCount = 0;
|
||||
continue;
|
||||
@ -471,7 +471,7 @@ DWORD WINAPI ReaderThread(LPVOID threadParam)
|
||||
dataLen = strlen(currentAddress);
|
||||
|
||||
*(ThreadParam*)buffer = { GetCurrentProcessId(), hook->hp.address, 0, 0 };
|
||||
memcpy(buffer + sizeof(ThreadParam), currentAddress, dataLen);
|
||||
memcpy(buffer + sizeof(ThreadParam), currentAddress, dataLen + 1);
|
||||
DWORD unused;
|
||||
WriteFile(::hookPipe, buffer, dataLen + sizeof(ThreadParam), &unused, nullptr);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ BOOL WINAPI DllMain(HINSTANCE hModule, DWORD fdwReason, LPVOID unused)
|
||||
{
|
||||
::running = false;
|
||||
|
||||
for (TextHook *man = ::hookman; man < ::hookman + MAX_HOOK; man++) man->ClearHook();
|
||||
for (TextHook *man = ::hookman; man < ::hookman + MAX_HOOK; man++) if (man->Address()) man->ClearHook();
|
||||
//if (ith_has_section)
|
||||
UnmapViewOfFile(::hookman);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user