Added Method to check if a service is stopped

This commit is contained in:
Jan Kevin Dick
2019-11-18 10:14:39 +01:00
parent 5a484c1896
commit 34ad48d16c
4 changed files with 25 additions and 1 deletions

View File

@@ -164,6 +164,15 @@ bool WinService::isRunning() const
return ss.dwCurrentState == SERVICE_RUNNING;
}
bool WinService::isStopped() const
{
open();
SERVICE_STATUS ss;
if (!QueryServiceStatus(_svcHandle, &ss))
throw SystemException("cannot query service status", _name);
return ss.dwCurrentState == SERVICE_STOPPED;
}
void WinService::start()
{