services: Fix handling of user defined service controls.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2016-08-10 10:42:35 +02:00 committed by Alexandre Julliard
parent 31d8d19890
commit cbc5de1c5f
2 changed files with 10 additions and 0 deletions

View File

@ -941,6 +941,9 @@ static BOOL service_accepts_control(const struct service_entry *service, DWORD d
{ {
DWORD a = service->status.dwControlsAccepted; DWORD a = service->status.dwControlsAccepted;
if (dwControl >= 128 && dwControl <= 255)
return TRUE;
switch (dwControl) switch (dwControl)
{ {
case SERVICE_CONTROL_INTERROGATE: case SERVICE_CONTROL_INTERROGATE:

View File

@ -83,6 +83,9 @@ static DWORD WINAPI service_handler(DWORD ctrl, DWORD event_type, void *event_da
SetServiceStatus(service_handle, &status); SetServiceStatus(service_handle, &status);
SetEvent(service_stop_event); SetEvent(service_stop_event);
return NO_ERROR; return NO_ERROR;
case 128:
service_event("CUSTOM");
return 0xdeadbeef;
default: default:
status.dwCurrentState = SERVICE_RUNNING; status.dwCurrentState = SERVICE_RUNNING;
SetServiceStatus( service_handle, &status ); SetServiceStatus( service_handle, &status );
@ -346,6 +349,10 @@ static void test_service(void)
ok(status.dwCheckPoint == 0, "status.dwCheckPoint = %d\n", status.dwCheckPoint); ok(status.dwCheckPoint == 0, "status.dwCheckPoint = %d\n", status.dwCheckPoint);
todo_wine ok(status.dwWaitHint == 0, "status.dwWaitHint = %d\n", status.dwWaitHint); todo_wine ok(status.dwWaitHint == 0, "status.dwWaitHint = %d\n", status.dwWaitHint);
res = ControlService(service_handle, 128, &status);
ok(res, "ControlService failed: %u\n", GetLastError());
expect_event("CUSTOM");
res = ControlService(service_handle, SERVICE_CONTROL_STOP, &status); res = ControlService(service_handle, SERVICE_CONTROL_STOP, &status);
ok(res, "ControlService failed: %u\n", GetLastError()); ok(res, "ControlService failed: %u\n", GetLastError());
expect_event("STOP"); expect_event("STOP");