mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-16 23:12:57 +02:00
fixed Process::isRunning() on Windows
This commit is contained in:
parent
d14be5730a
commit
5c04101a35
@ -260,23 +260,19 @@ bool ProcessImpl::isRunningImpl(const ProcessHandleImpl& handle)
|
|||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
DWORD exitCode;
|
DWORD exitCode;
|
||||||
|
BOOL rc = GetExitCodeProcess(handle.process(), &exitCode);
|
||||||
GetExitCodeProcess(handle.process(), &exitCode);
|
if (!rc || exitCode != STILL_ACTIVE) result = false;
|
||||||
if (exitCode != STILL_ACTIVE) result = false;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ProcessImpl::isRunningImpl(PIDImpl pid)
|
bool ProcessImpl::isRunningImpl(PIDImpl pid)
|
||||||
{
|
{
|
||||||
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
|
HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
|
||||||
bool result = true;
|
bool result = true;
|
||||||
DWORD exitCode;
|
DWORD exitCode;
|
||||||
|
BOOL rc = GetExitCodeProcess(hProc, &exitCode);
|
||||||
GetExitCodeProcess(hProc, &exitCode);
|
if (!rc || exitCode != STILL_ACTIVE) result = false;
|
||||||
if (exitCode != STILL_ACTIVE) result = false;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,23 +266,19 @@ bool ProcessImpl::isRunningImpl(const ProcessHandleImpl& handle)
|
|||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
DWORD exitCode;
|
DWORD exitCode;
|
||||||
|
BOOL rc = GetExitCodeProcess(handle.process(), &exitCode);
|
||||||
GetExitCodeProcess(handle.process(), &exitCode);
|
if (!rc || exitCode != STILL_ACTIVE) result = false;
|
||||||
if (exitCode != STILL_ACTIVE) result = false;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ProcessImpl::isRunningImpl(PIDImpl pid)
|
bool ProcessImpl::isRunningImpl(PIDImpl pid)
|
||||||
{
|
{
|
||||||
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
|
HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
|
||||||
bool result = true;
|
bool result = true;
|
||||||
DWORD exitCode;
|
DWORD exitCode;
|
||||||
|
BOOL rc = GetExitCodeProcess(hProc, &exitCode);
|
||||||
GetExitCodeProcess(hProc, &exitCode);
|
if (!rc || exitCode != STILL_ACTIVE) result = false;
|
||||||
if (exitCode != STILL_ACTIVE) result = false;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,25 +191,20 @@ bool ProcessImpl::isRunningImpl(const ProcessHandleImpl& handle)
|
|||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
DWORD exitCode;
|
DWORD exitCode;
|
||||||
|
BOOL rc = GetExitCodeProcess(handle.process(), &exitCode);
|
||||||
GetExitCodeProcess(handle.process(), &exitCode);
|
if (!rc || exitCode != STILL_ACTIVE) result = false;
|
||||||
if (exitCode != STILL_ACTIVE) result = false;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ProcessImpl::isRunningImpl(PIDImpl pid)
|
bool ProcessImpl::isRunningImpl(PIDImpl pid)
|
||||||
{
|
{
|
||||||
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
|
HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
|
||||||
bool result = true;
|
bool result = true;
|
||||||
DWORD exitCode;
|
DWORD exitCode;
|
||||||
|
BOOL rc = GetExitCodeProcess(hProc, &exitCode);
|
||||||
GetExitCodeProcess(hProc, &exitCode);
|
if (!rc || exitCode != STILL_ACTIVE) result = false;
|
||||||
if (exitCode != STILL_ACTIVE) result = false;
|
return result;}
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ProcessImpl::requestTerminationImpl(PIDImpl pid)
|
void ProcessImpl::requestTerminationImpl(PIDImpl pid)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user