This commit is contained in:
Akash Mozumdar 2018-08-22 00:23:41 -04:00
parent 911fb991be
commit a89e33c68a

View File

@ -31,15 +31,17 @@ DWORD WINAPI PipeManager(LPVOID unused)
while (::hookPipe == INVALID_HANDLE_VALUE || hostPipe == INVALID_HANDLE_VALUE) while (::hookPipe == INVALID_HANDLE_VALUE || hostPipe == INVALID_HANDLE_VALUE)
{ {
Sleep(STANDARD_WAIT);
if (::hookPipe == INVALID_HANDLE_VALUE) if (::hookPipe == INVALID_HANDLE_VALUE)
{ {
::hookPipe = CreateFileW(ITH_TEXT_PIPE, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); ::hookPipe = CreateFileW(ITH_TEXT_PIPE, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
} }
if (hostPipe == INVALID_HANDLE_VALUE) 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(); *(DWORD*)buffer = GetCurrentProcessId();