MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / WaitService

Function WaitService

sourcecommon/utils.cpp:1435–1458  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1433}
1434//---------------------------------------------------------------------------
1435bool __fastcall WaitService(char * szServiceName, DWORD dwCurrentState, DWORD to)
1436{
1437 bool rv = false;
1438 SC_HANDLE hsm, hs; DWORD tc; SERVICE_STATUS SS;
1439 hsm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
1440 if( !hsm )
1441 {
1442 Sleep(to);
1443 return rv;
1444 }
1445 hs = OpenService(hsm, szServiceName, SERVICE_ALL_ACCESS);
1446 if( !hs )
1447 {
1448 CloseServiceHandle(hsm);
1449 return rv;
1450 }
1451 tc = GetTickCount();
1452 while( QueryServiceStatus(hs, &SS) && SS.dwCurrentState!=dwCurrentState && GetTickCount()-tc<to ) Sleep(2);
1453 if( SS.dwCurrentState==dwCurrentState )
1454 rv = true;
1455 CloseServiceHandle(hs);
1456 CloseServiceHandle(hsm);
1457 return rv;
1458}
1459//---------------------------------------------------------------------------
1460void StringGridToClipboard(TStringGrid * p)
1461{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected