Paul Vriens : advapi32/service: Handle is checked before servicename.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jul 24 07:06:08 CDT 2007


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

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Mon Jul 23 21:07:55 2007 +0200

advapi32/service: Handle is checked before servicename.

---

 dlls/advapi32/service.c       |   20 ++++++++++----------
 dlls/advapi32/tests/service.c |    1 -
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index eb1c30f..1ecaf70 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -2273,16 +2273,16 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
     TRACE("%p %s %p %p\n", hSCManager,
           debugstr_a(lpServiceName), lpDisplayName, lpcchBuffer);
 
-    if (!lpServiceName)
+    hscm = sc_handle_get_handle_data(hSCManager, SC_HTYPE_MANAGER);
+    if (!hscm)
     {
-        SetLastError(ERROR_INVALID_PARAMETER);
+        SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
     }
 
-    hscm = sc_handle_get_handle_data(hSCManager, SC_HTYPE_MANAGER);
-    if (!hscm)
+    if (!lpServiceName)
     {
-        SetLastError(ERROR_INVALID_HANDLE);
+        SetLastError(ERROR_INVALID_ADDRESS);
         return FALSE;
     }
 
@@ -2320,16 +2320,16 @@ BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
     TRACE("%p %s %p %p\n", hSCManager,
           debugstr_w(lpServiceName), lpDisplayName, lpcchBuffer);
 
-    if (!lpServiceName)
+    hscm = sc_handle_get_handle_data(hSCManager, SC_HTYPE_MANAGER);
+    if (!hscm)
     {
-        SetLastError(ERROR_INVALID_PARAMETER);
+        SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
     }
 
-    hscm = sc_handle_get_handle_data(hSCManager, SC_HTYPE_MANAGER);
-    if (!hscm)
+    if (!lpServiceName)
     {
-        SetLastError(ERROR_INVALID_HANDLE);
+        SetLastError(ERROR_INVALID_ADDRESS);
         return FALSE;
     }
 
diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c
index 61d18dd..adbfe2b 100644
--- a/dlls/advapi32/tests/service.c
+++ b/dlls/advapi32/tests/service.c
@@ -392,7 +392,6 @@ static void test_get_displayname(void)
     SetLastError(0xdeadbeef);
     ret = GetServiceDisplayNameA(NULL, NULL, NULL, &displaysize);
     ok(!ret, "Expected failure\n");
-    todo_wine
     ok(GetLastError() == ERROR_INVALID_HANDLE,
        "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
 




More information about the wine-cvs mailing list