Commit cbc5de1c authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

services: Fix handling of user defined service controls.

parent 31d8d198
......@@ -941,6 +941,9 @@ static BOOL service_accepts_control(const struct service_entry *service, DWORD d
{
DWORD a = service->status.dwControlsAccepted;
if (dwControl >= 128 && dwControl <= 255)
return TRUE;
switch (dwControl)
{
case SERVICE_CONTROL_INTERROGATE:
......
......@@ -83,6 +83,9 @@ static DWORD WINAPI service_handler(DWORD ctrl, DWORD event_type, void *event_da
SetServiceStatus(service_handle, &status);
SetEvent(service_stop_event);
return NO_ERROR;
case 128:
service_event("CUSTOM");
return 0xdeadbeef;
default:
status.dwCurrentState = SERVICE_RUNNING;
SetServiceStatus( service_handle, &status );
......@@ -346,6 +349,10 @@ static void test_service(void)
ok(status.dwCheckPoint == 0, "status.dwCheckPoint = %d\n", status.dwCheckPoint);
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);
ok(res, "ControlService failed: %u\n", GetLastError());
expect_event("STOP");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment