Paul Vriens : advapi32/tests: Add another test.

Alexandre Julliard julliard at winehq.org
Wed May 7 07:03:57 CDT 2008


Module: wine
Branch: master
Commit: deee97d9eaa7dfe28a9e39f288c3c7ed39f6e7c8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=deee97d9eaa7dfe28a9e39f288c3c7ed39f6e7c8

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Tue May  6 18:08:09 2008 +0200

advapi32/tests: Add another test.

---

 dlls/advapi32/tests/service.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c
index d299d2d..8ffe2e8 100644
--- a/dlls/advapi32/tests/service.c
+++ b/dlls/advapi32/tests/service.c
@@ -94,6 +94,8 @@ static void test_open_scm(void)
 static void test_open_svc(void)
 {
     SC_HANDLE scm_handle, svc_handle;
+    CHAR displayname[4096];
+    DWORD displaysize;
 
     /* All NULL (invalid access rights) */
     SetLastError(0xdeadbeef);
@@ -135,6 +137,21 @@ static void test_open_svc(void)
            "Expected ERROR_SUCCESS or 0xdeadbeef, got %d\n", GetLastError());
         CloseServiceHandle(svc_handle);
     }
+
+    /* Test to show we can't open a service with the displayname */
+
+    /* Retrieve the needed size for the buffer */
+    displaysize = 0;
+    GetServiceDisplayNameA(scm_handle, spooler, NULL, &displaysize);
+    /* Get the displayname */
+    GetServiceDisplayNameA(scm_handle, spooler, displayname, &displaysize);
+    /* Try to open the service with this displayname */
+    svc_handle = OpenServiceA(scm_handle, displayname, GENERIC_READ);
+    ok(!svc_handle, "Expected failure\n");
+    ok(GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST, "Expected ERROR_SERVICE_DOES_NOT_EXIST, got %d\n", GetLastError());
+    /* Just in case */
+    CloseServiceHandle(svc_handle);
+
     CloseServiceHandle(scm_handle);
 }
 




More information about the wine-cvs mailing list