From a89e33c68ac1f5e2ca35f71e56d89242edcb6b47 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Wed, 22 Aug 2018 00:23:41 -0400 Subject: [PATCH] bugfix --- vnrhook/src/pipe.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vnrhook/src/pipe.cc b/vnrhook/src/pipe.cc index b0ea609..8818336 100644 --- a/vnrhook/src/pipe.cc +++ b/vnrhook/src/pipe.cc @@ -31,15 +31,17 @@ DWORD WINAPI PipeManager(LPVOID unused) while (::hookPipe == INVALID_HANDLE_VALUE || hostPipe == INVALID_HANDLE_VALUE) { - Sleep(STANDARD_WAIT); if (::hookPipe == INVALID_HANDLE_VALUE) { ::hookPipe = CreateFileW(ITH_TEXT_PIPE, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); } if (hostPipe == INVALID_HANDLE_VALUE) { - hostPipe = CreateFileW(ITH_COMMAND_PIPE, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + hostPipe = CreateFileW(ITH_COMMAND_PIPE, GENERIC_READ | FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + DWORD mode = PIPE_READMODE_MESSAGE; + SetNamedPipeHandleState(hostPipe, &mode, NULL, NULL); } + Sleep(STANDARD_WAIT); } *(DWORD*)buffer = GetCurrentProcessId();