This commit is contained in:
Akash Mozumdar 2018-09-01 14:11:48 -04:00
parent 50fc7e24c6
commit 88d67c5378
2 changed files with 5 additions and 8 deletions

View File

@ -77,13 +77,13 @@ namespace
CloseHandle(pr.processHandle); CloseHandle(pr.processHandle);
CloseHandle(pr.section); CloseHandle(pr.section);
processRecordsByIds[pid] = {}; processRecordsByIds[pid] = {};
RemoveThreads([=](ThreadParam tp) { return tp.pid == pid; }); RemoveThreads([&](ThreadParam tp) { return tp.pid == pid; });
OnDetach(pid); OnDetach(pid);
} }
void StartPipe() void StartPipe()
{ {
std::thread([]() std::thread([]
{ {
HANDLE hookPipe = CreateNamedPipeW(ITH_TEXT_PIPE, PIPE_ACCESS_INBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, PIPE_BUFFER_SIZE, MAXDWORD, NULL); HANDLE hookPipe = CreateNamedPipeW(ITH_TEXT_PIPE, PIPE_ACCESS_INBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, PIPE_BUFFER_SIZE, MAXDWORD, NULL);
HANDLE hostPipe = CreateNamedPipeW(ITH_COMMAND_PIPE, PIPE_ACCESS_OUTBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, PIPE_BUFFER_SIZE, MAXDWORD, NULL); HANDLE hostPipe = CreateNamedPipeW(ITH_COMMAND_PIPE, PIPE_ACCESS_OUTBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, PIPE_BUFFER_SIZE, MAXDWORD, NULL);
@ -106,7 +106,7 @@ namespace
case HOST_NOTIFICATION_RMVHOOK: case HOST_NOTIFICATION_RMVHOOK:
{ {
auto info = *(HookRemovedNotif*)buffer; auto info = *(HookRemovedNotif*)buffer;
RemoveThreads([=](ThreadParam tp) { return tp.pid == processId && tp.hook == info.address; }); RemoveThreads([&](ThreadParam tp) { return tp.pid == processId && tp.hook == info.address; });
} }
break; break;
case HOST_NOTIFICATION_TEXT: case HOST_NOTIFICATION_TEXT:
@ -264,10 +264,7 @@ namespace Host
return textThreadsByParams[tp]; return textThreadsByParams[tp];
} }
void AddConsoleOutput(std::wstring text) void AddConsoleOutput(std::wstring text) { GetThread(CONSOLE)->AddSentence(std::wstring(text)); }
{
GetThread(CONSOLE)->AddSentence(std::wstring(text));
}
} }
// EOF // EOF

View File

@ -30,7 +30,7 @@ private:
std::recursive_mutex ttMutex; std::recursive_mutex ttMutex;
HANDLE deletionEvent = CreateEventW(nullptr, FALSE, FALSE, NULL); HANDLE deletionEvent = CreateEventW(nullptr, FALSE, FALSE, NULL);
std::thread flushThread = std::thread([&]() { while (WaitForSingleObject(deletionEvent, 100) == WAIT_TIMEOUT) Flush(); }); std::thread flushThread = std::thread([&] { while (WaitForSingleObject(deletionEvent, 100) == WAIT_TIMEOUT) Flush(); });
DWORD timestamp = GetTickCount(); DWORD timestamp = GetTickCount();
ThreadOutputCallback Output; ThreadOutputCallback Output;