advapi32: Accept a NULL lpServiceStatus in ControlService.

This commit is contained in:
Paul Chitescu 2008-01-09 19:58:48 +02:00 committed by Alexandre Julliard
parent 95fa37ff84
commit 038c3a264b
1 changed files with 21 additions and 18 deletions

View File

@ -1037,26 +1037,29 @@ BOOL WINAPI ControlService( SC_HANDLE hService, DWORD dwControl,
return FALSE;
}
ret = QueryServiceStatus(hService, lpServiceStatus);
if (!ret)
if (lpServiceStatus)
{
ERR("failed to query service status\n");
SetLastError(ERROR_SERVICE_NOT_ACTIVE);
return FALSE;
}
ret = QueryServiceStatus(hService, lpServiceStatus);
if (!ret)
{
ERR("failed to query service status\n");
SetLastError(ERROR_SERVICE_NOT_ACTIVE);
return FALSE;
}
switch (lpServiceStatus->dwCurrentState)
{
case SERVICE_STOPPED:
SetLastError(ERROR_SERVICE_NOT_ACTIVE);
return FALSE;
case SERVICE_START_PENDING:
if (dwControl==SERVICE_CONTROL_STOP)
break;
/* fall thru */
case SERVICE_STOP_PENDING:
SetLastError(ERROR_SERVICE_CANNOT_ACCEPT_CTRL);
return FALSE;
switch (lpServiceStatus->dwCurrentState)
{
case SERVICE_STOPPED:
SetLastError(ERROR_SERVICE_NOT_ACTIVE);
return FALSE;
case SERVICE_START_PENDING:
if (dwControl==SERVICE_CONTROL_STOP)
break;
/* fall thru */
case SERVICE_STOP_PENDING:
SetLastError(ERROR_SERVICE_CANNOT_ACCEPT_CTRL);
return FALSE;
}
}
handle = service_open_pipe(hsvc->name);