From 9084b9761d7e4088f5aaa9e9aca0e13b033e0c1d Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 28 Jan 2019 15:52:06 +0100 Subject: [PATCH] advapi32/tests: Add test using NotifyServiceStatusChange on different handles of the same service. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/advapi32/tests/service.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c index cc4834753d5..1552791a66b 100644 --- a/dlls/advapi32/tests/service.c +++ b/dlls/advapi32/tests/service.c @@ -2350,7 +2350,7 @@ static void test_servicenotify(SC_HANDLE scm_handle, const char *servicename) ok(dr == WAIT_IO_COMPLETION, "Got wrong SleepEx result: %u\n", dr); ok(data.was_called == TRUE, "APC wasn't called\n"); - /* cannot register two notifications */ + /* cannot register two notifications on the same handle */ data.phase = PHASE_STOPPED; data.was_called = FALSE; @@ -2373,13 +2373,29 @@ static void test_servicenotify(SC_HANDLE scm_handle, const char *servicename) (dr == ERROR_ALREADY_REGISTERED && dr2 == 0), "Got wrong SleepEx result: %u\n", dr); ok(data.was_called == FALSE, "APC should not have been called\n"); + memset(&data2.notify, 0, sizeof(data2.notify)); + data2.notify.dwVersion = SERVICE_NOTIFY_STATUS_CHANGE; + data2.notify.pfnNotifyCallback = ¬ify_cb; + data2.notify.pContext = &data; + data2.svc = svc2; + data2.phase = PHASE_STOPPED; + data2.was_called = FALSE; + + /* it's possible to have multiple notifications using different service handles */ + dr = pNotifyServiceStatusChangeW(svc2, SERVICE_NOTIFY_STOPPED, &data2.notify); + todo_wine + ok(dr == ERROR_SUCCESS, "NotifyServiceStatusChangeW gave wrong result: %u\n", dr); + /* stop service and receive notifiction */ br = ControlService(svc, SERVICE_CONTROL_STOP, &status); ok(br, "ControlService failed: %u\n", GetLastError()); dr = SleepEx(100, TRUE); - ok(dr == WAIT_IO_COMPLETION, "Got wrong SleepEx result: %u\n", dr); + dr2 = SleepEx(100, TRUE); + ok(dr == WAIT_IO_COMPLETION || dr2 == WAIT_IO_COMPLETION, "Got wrong SleepEx result: %u\n", dr); ok(data.was_called == TRUE, "APC wasn't called\n"); + todo_wine + ok(data2.was_called == TRUE, "APC wasn't called\n"); /* test cancelation: create notify on svc that will block until service * start; close svc; start service on svc2; verify that notification does