| 28 | } |
| 29 | |
| 30 | std::map<std::string, std::uint32_t> CProcess::GetProcessList() |
| 31 | { |
| 32 | std::map<std::string, uint32_t> ProcessList; |
| 33 | PROCESSENTRY32 pe32; |
| 34 | HANDLE hSnapshot = 0; |
| 35 | hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); |
| 36 | if (hSnapshot == INVALID_HANDLE_VALUE || hSnapshot == 0) |
| 37 | goto EXIT; |
| 38 | pe32.dwSize = sizeof(PROCESSENTRY32); |
| 39 | if (!Process32First(hSnapshot, &pe32)) |
| 40 | goto EXIT; |
| 41 | do |
| 42 | { |
| 43 | ProcessList[pe32.szExeFile] = pe32.th32ProcessID; |
| 44 | } while (Process32Next(hSnapshot, &pe32)); |
| 45 | EXIT: |
| 46 | if(hSnapshot) |
| 47 | CloseHandle(hSnapshot); |
| 48 | return ProcessList; |
| 49 | } |
| 50 | |
| 51 | bool CProcess::Wait(uint32_t Interval) |
| 52 | { |