| 29 | |
| 30 | |
| 31 | static bool ExecuteCommand(const std::string& app, const std::string& arguments) |
| 32 | { |
| 33 | SHELLEXECUTEINFO sei = {}; |
| 34 | sei.cbSize = sizeof(sei); |
| 35 | sei.fMask = SEE_MASK_NOCLOSEPROCESS; |
| 36 | sei.lpFile = app.c_str(); |
| 37 | sei.lpParameters = arguments.c_str(); |
| 38 | sei.nShow = SW_HIDE; |
| 39 | if (!ShellExecuteEx(&sei)) |
| 40 | return false; |
| 41 | |
| 42 | if (!sei.hProcess) |
| 43 | return false; |
| 44 | |
| 45 | WaitForSingleObject(sei.hProcess, INFINITE); |
| 46 | |
| 47 | DWORD exitCode; |
| 48 | BOOL res = GetExitCodeProcess(sei.hProcess, &exitCode); |
| 49 | CloseHandle(sei.hProcess); |
| 50 | |
| 51 | if (!res) |
| 52 | return false; |
| 53 | |
| 54 | return exitCode == 0; |
| 55 | } |
| 56 | |
| 57 | static bool ExecuteIcingaCommand(const std::string& arguments) |
| 58 | { |
no outgoing calls
no test coverage detected