Jacek Caban : advapi32/tests: Add test using NotifyServiceStatusChange on different handles of the same service.

Alexandre Julliard julliard at winehq.org
Mon Jan 28 16:17:02 CST 2019


Module: wine
Branch: master
Commit: 9084b9761d7e4088f5aaa9e9aca0e13b033e0c1d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9084b9761d7e4088f5aaa9e9aca0e13b033e0c1d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jan 28 15:52:06 2019 +0100

advapi32/tests: Add test using NotifyServiceStatusChange on different handles of the same service.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 cc48347..1552791 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 = &notify_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




More information about the wine-cvs mailing list