Init
| 32 | |
| 33 | // Init |
| 34 | bool DllReaderInit(std::vector<HANDLE>& threads) { |
| 35 | hStopEventDll = CreateEvent(NULL, TRUE, FALSE, NULL); |
| 36 | if (hStopEventDll == NULL) { |
| 37 | LOG_A(LOG_ERROR, "DllReader: Failed to create stop event"); |
| 38 | return false; |
| 39 | } |
| 40 | threadReadynessDll = CreateEvent(NULL, TRUE, FALSE, NULL); |
| 41 | if (threadReadynessDll == NULL) { |
| 42 | LOG_A(LOG_ERROR, "DllReader: Failed to create event for thread readyness"); |
| 43 | CloseHandle(hStopEventDll); |
| 44 | hStopEventDll = NULL; |
| 45 | return false; |
| 46 | } |
| 47 | |
| 48 | HANDLE thread = CreateThread(NULL, 0, DllReaderThread, NULL, 0, NULL); |
| 49 | if (thread == NULL) { |
| 50 | LOG_A(LOG_ERROR, "DllReader: Failed to create thread"); |
| 51 | return false; |
| 52 | } |
| 53 | hDllServerThreadHandle = thread; |
| 54 | |
| 55 | WaitForSingleObject(threadReadynessDll, INFINITE); |
| 56 | threads.push_back(thread); |
| 57 | |
| 58 | return true; |
| 59 | } |
| 60 | |
| 61 | |
| 62 | // Pipe Reader Thread: Server |