Fix pause / resume code. The buttons need fixing yet so it still won't work, although the menu items probably will.

svn path=/trunk/; revision=44976
This commit is contained in:
Ged Murphy 2010-01-06 13:10:09 +00:00
parent b8882998c7
commit 0c02d2184e

View file

@ -23,8 +23,23 @@ DoControl(PMAIN_WND_INFO Info,
DWORD dwOldCheckPoint; DWORD dwOldCheckPoint;
DWORD dwWaitTime; DWORD dwWaitTime;
DWORD dwMaxWait; DWORD dwMaxWait;
DWORD dwReqState;
BOOL bRet = FALSE; BOOL bRet = FALSE;
/* Set the state we're interested in */
switch (Control)
{
case SERVICE_CONTROL_PAUSE:
dwReqState = SERVICE_PAUSED;
break;
case SERVICE_CONTROL_CONTINUE:
dwReqState = SERVICE_RUNNING;
break;
default:
/* Unhandled control code */
return FALSE;
}
hSCManager = OpenSCManager(NULL, hSCManager = OpenSCManager(NULL,
NULL, NULL,
SC_MANAGER_CONNECT); SC_MANAGER_CONNECT);
@ -32,7 +47,7 @@ DoControl(PMAIN_WND_INFO Info,
{ {
hService = OpenService(hSCManager, hService = OpenService(hSCManager,
Info->pCurrentService->lpServiceName, Info->pCurrentService->lpServiceName,
SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_QUERY_CONFIG); SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_QUERY_STATUS);
if (hService) if (hService)
{ {
if (hProgress) if (hProgress)
@ -58,7 +73,7 @@ DoControl(PMAIN_WND_INFO Info,
dwStartTickCount = GetTickCount(); dwStartTickCount = GetTickCount();
/* Loop until it's at the correct state */ /* Loop until it's at the correct state */
while (ServiceStatus.dwCurrentState != Control) while (ServiceStatus.dwCurrentState != dwReqState)
{ {
dwOldCheckPoint = ServiceStatus.dwCheckPoint; dwOldCheckPoint = ServiceStatus.dwCheckPoint;
dwWaitTime = ServiceStatus.dwWaitHint / 10; dwWaitTime = ServiceStatus.dwWaitHint / 10;
@ -103,7 +118,7 @@ DoControl(PMAIN_WND_INFO Info,
} }
} }
if (ServiceStatus.dwCurrentState == Control) if (ServiceStatus.dwCurrentState == dwReqState)
{ {
bRet = TRUE; bRet = TRUE;
} }