| 91 | | #ifdef WIN32 |
|---|
| 92 | | HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, false, pid); |
|---|
| 93 | | if (hProcess == NULL) |
|---|
| 94 | | { |
|---|
| 95 | | if (GetLastError() != ERROR_INVALID_PARAMETER) |
|---|
| 96 | | { |
|---|
| 97 | | printf("Failed to open process %d: error %d\n", |
|---|
| 98 | | pid, (int)GetLastError()); |
|---|
| 99 | | } |
|---|
| | 91 | #ifdef WIN32 |
|---|
| | 92 | |
|---|
| | 93 | HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, |
|---|
| | 94 | false, pid); |
|---|
| | 95 | if (hProcess == NULL) |
|---|
| | 96 | { |
|---|
| | 97 | if (GetLastError() != ERROR_INVALID_PARAMETER) |
|---|
| | 98 | { |
|---|
| | 99 | BOX_ERROR("Failed to open process " << pid << |
|---|
| | 100 | ": " << |
|---|
| | 101 | GetErrorMessage(GetLastError())); |
|---|
| | 102 | } |
|---|
| | 103 | return false; |
|---|
| | 104 | } |
|---|
| | 105 | |
|---|
| | 106 | DWORD exitCode; |
|---|
| | 107 | BOOL result = GetExitCodeProcess(hProcess, &exitCode); |
|---|
| | 108 | CloseHandle(hProcess); |
|---|
| | 109 | |
|---|
| | 110 | if (result == 0) |
|---|
| | 111 | { |
|---|
| | 112 | BOX_ERROR("Failed to get exit code for process " << |
|---|
| | 113 | pid << ": " << |
|---|
| | 114 | GetErrorMessage(GetLastError())) |
|---|
| | 115 | return false; |
|---|
| | 116 | } |
|---|
| | 117 | |
|---|
| | 118 | if (exitCode == STILL_ACTIVE) |
|---|
| | 119 | { |
|---|
| | 120 | return true; |
|---|
| | 121 | } |
|---|
| | 122 | |
|---|