mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
[SERVICES]
RControlService: Check the current state before sending a control request. svn path=/trunk/; revision=49259
This commit is contained in:
parent
3a7694182b
commit
4cb29716d1
1 changed files with 28 additions and 1 deletions
|
@ -553,6 +553,7 @@ DWORD RControlService(
|
|||
DWORD pcbBytesNeeded = 0;
|
||||
DWORD dwServicesReturned = 0;
|
||||
DWORD dwControlsAccepted;
|
||||
DWORD dwCurrentState;
|
||||
HKEY hServicesKey = NULL;
|
||||
|
||||
DPRINT("RControlService() called\n");
|
||||
|
@ -655,8 +656,34 @@ DWORD RControlService(
|
|||
else
|
||||
{
|
||||
dwControlsAccepted = lpService->Status.dwControlsAccepted;
|
||||
dwCurrentState = lpService->Status.dwCurrentState;
|
||||
|
||||
/* Check if the control code is acceptable */
|
||||
/* Check the current state before sending a control request */
|
||||
switch (dwCurrentState)
|
||||
{
|
||||
case SERVICE_STOP_PENDING:
|
||||
case SERVICE_STOPPED:
|
||||
return ERROR_SERVICE_CANNOT_ACCEPT_CTRL;
|
||||
|
||||
case SERVICE_START_PENDING:
|
||||
switch (dwControl)
|
||||
{
|
||||
case SERVICE_CONTROL_STOP:
|
||||
break;
|
||||
|
||||
case SERVICE_CONTROL_INTERROGATE:
|
||||
RtlCopyMemory(lpServiceStatus,
|
||||
&lpService->Status,
|
||||
sizeof(SERVICE_STATUS));
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
default:
|
||||
return ERROR_SERVICE_CANNOT_ACCEPT_CTRL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check if the control code is acceptable to the service */
|
||||
switch (dwControl)
|
||||
{
|
||||
case SERVICE_CONTROL_STOP:
|
||||
|
|
Loading…
Reference in a new issue