add is_running support

This commit is contained in:
Yuval Kashtan
2014-08-11 09:10:48 +03:00
parent 7a008cbc76
commit af44951e77
14 changed files with 126 additions and 0 deletions

View File

@@ -261,6 +261,27 @@ void ProcessImpl::killImpl(PIDImpl pid)
}
}
bool ProcessImpl::isRunningImpl(const ProcessHandleImpl& handle)
{
BOOL fRC = true;
DWORD exit_code;
GetExitCodeProcess(handle.process(), &exit_code);
if (exit_code != STILL_ACTIVE) fRC = false;
return fRC;
}
bool ProcessImpl::isRunningImpl(PIDImpl pid)
{
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
BOOL fRC = true;
DWORD exit_code;
GetExitCodeProcess(hProc, &exit_code);
if (exit_code != STILL_ACTIVE) fRC = false;
return fRC;
}
void ProcessImpl::requestTerminationImpl(PIDImpl pid)
{