From b903d777301f65c0de66fb6d8f53cb6653f86e5a Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Fri, 13 Jul 2018 20:51:09 -0400 Subject: [PATCH] hotfix for win7 --- vnr/texthook/host/host.cc | 9 ++++++--- vnr/vnrhook/src/hijack/texthook.cc | 4 ++-- vnr/vnrhook/src/pipe.cc | 8 +++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/vnr/texthook/host/host.cc b/vnr/texthook/host/host.cc index 02e8efd..a1fb258 100644 --- a/vnr/texthook/host/host.cc +++ b/vnr/texthook/host/host.cc @@ -200,7 +200,8 @@ IHFSERVICE bool IHFAPI InjectProcessById(DWORD processId, DWORD timeout) IHFSERVICE bool IHFAPI DetachProcessById(DWORD processId) { DWORD command = HOST_COMMAND_DETACH; - return WriteFile(man->GetCommandPipe(processId), &command, sizeof(command), nullptr, nullptr); + DWORD unused; + return WriteFile(man->GetCommandPipe(processId), &command, sizeof(command), &unused, nullptr); } IHFSERVICE void IHFAPI GetHostHookManager(HookManager** hookman) @@ -230,7 +231,8 @@ IHFSERVICE DWORD IHFAPI InsertHook(DWORD pid, const HookParam *hp, std::string n memcpy(buffer + 4, hp, sizeof(HookParam)); if (name.size()) strcpy((char*)buffer + 4 + sizeof(HookParam), name.c_str()); - WriteFile(commandPipe, buffer, 4 + sizeof(HookParam) + name.size(), nullptr, nullptr); + DWORD unused; + WriteFile(commandPipe, buffer, 4 + sizeof(HookParam) + name.size(), &unused, nullptr); return 0; } @@ -245,7 +247,8 @@ IHFSERVICE DWORD IHFAPI RemoveHook(DWORD pid, DWORD addr) *(DWORD*)buffer = HOST_COMMAND_REMOVE_HOOK; *(DWORD*)(buffer + 4) = addr; - WriteFile(commandPipe, buffer, 8, nullptr, nullptr); + DWORD unused; + WriteFile(commandPipe, buffer, 8, &unused, nullptr); WaitForSingleObject(hookRemovalEvent, 1000); CloseHandle(hookRemovalEvent); man->RemoveSingleHook(pid, addr); diff --git a/vnr/vnrhook/src/hijack/texthook.cc b/vnr/vnrhook/src/hijack/texthook.cc index bf9a28f..9c21bf7 100644 --- a/vnr/vnrhook/src/hijack/texthook.cc +++ b/vnr/vnrhook/src/hijack/texthook.cc @@ -477,10 +477,10 @@ DWORD TextHook::UnsafeSend(DWORD dwDataBase, DWORD dwRetn) *((DWORD *)pbData + 1) = dwRetn; *((DWORD *)pbData + 2) = dwSplit; if (dwCount) { - IO_STATUS_BLOCK ios = {}; + DWORD unused; //CliLockPipe(); - WriteFile(::hookPipe, pbData, dwCount + HEADER_SIZE, nullptr, nullptr); + WriteFile(::hookPipe, pbData, dwCount + HEADER_SIZE, &unused, nullptr); //CliUnlockPipe(); } if (pbData != pbSmallBuff) diff --git a/vnr/vnrhook/src/pipe.cc b/vnr/vnrhook/src/pipe.cc index 06d117b..9b1f125 100644 --- a/vnr/vnrhook/src/pipe.cc +++ b/vnr/vnrhook/src/pipe.cc @@ -43,7 +43,7 @@ DWORD WINAPI PipeManager(LPVOID unused) } *(DWORD*)buffer = GetCurrentProcessId(); - WriteFile(::hookPipe, buffer, sizeof(DWORD), nullptr, nullptr); + WriteFile(::hookPipe, buffer, sizeof(DWORD), &count, nullptr); for (int i = 0, count = 0; count < ::currentHook; i++) { @@ -131,7 +131,8 @@ void ConsoleOutput(LPCSTR text) *(DWORD*)buffer = HOST_NOTIFICATION; //cmd *(DWORD*)(buffer + 4) = HOST_NOTIFICATION_TEXT; //console memcpy(buffer + 8, text, textSize); - WriteFile(::hookPipe, buffer, dataSize, nullptr, nullptr); + DWORD unused; + WriteFile(::hookPipe, buffer, dataSize, &unused, nullptr); } // Artikash 7/3/2018: TODO: Finish using this in vnrhost instead of section to deliver hook name @@ -146,7 +147,8 @@ void NotifyHookInsert(HookParam hp, LPCSTR name) *(DWORD*)(buffer + 4) = HOST_NOTIFICATION_NEWHOOK; *(HookParam*)(buffer + 8) = hp; strcpy((char*)buffer + 8 + sizeof(HookParam), name); - WriteFile(::hookPipe, buffer, strlen(name) + 8 + sizeof(HookParam), nullptr, nullptr); + DWORD unused; + WriteFile(::hookPipe, buffer, strlen(name) + 8 + sizeof(HookParam), &unused, nullptr); return; }