hotfix for win7

This commit is contained in:
Akash Mozumdar 2018-07-13 20:51:09 -04:00
parent ef36cb9274
commit b903d77730
3 changed files with 13 additions and 8 deletions

View File

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

View File

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

View File

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