Paul Chitescu : advapi32: Accept a NULL lpServiceStatus in ControlService.

Alexandre Julliard julliard at winehq.org
Thu Jan 10 06:42:04 CST 2008


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

Author: Paul Chitescu <paulc at voip.null.ro>
Date:   Wed Jan  9 19:58:48 2008 +0200

advapi32: Accept a NULL lpServiceStatus in ControlService.

---

 dlls/advapi32/service.c |   39 +++++++++++++++++++++------------------
 1 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index 4c03c1e..7cfd9ea 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -1037,26 +1037,29 @@ BOOL WINAPI ControlService( SC_HANDLE hService, DWORD dwControl,
         return FALSE;
     }
 
-    ret = QueryServiceStatus(hService, lpServiceStatus);
-    if (!ret)
+    if (lpServiceStatus)
     {
-        ERR("failed to query service status\n");
-        SetLastError(ERROR_SERVICE_NOT_ACTIVE);
-        return FALSE;
-    }
+        ret = QueryServiceStatus(hService, lpServiceStatus);
+        if (!ret)
+        {
+            ERR("failed to query service status\n");
+            SetLastError(ERROR_SERVICE_NOT_ACTIVE);
+            return FALSE;
+        }
 
-    switch (lpServiceStatus->dwCurrentState)
-    {
-    case SERVICE_STOPPED:
-        SetLastError(ERROR_SERVICE_NOT_ACTIVE);
-        return FALSE;
-    case SERVICE_START_PENDING:
-        if (dwControl==SERVICE_CONTROL_STOP)
-            break;
-        /* fall thru */
-    case SERVICE_STOP_PENDING:
-        SetLastError(ERROR_SERVICE_CANNOT_ACCEPT_CTRL);
-        return FALSE;
+        switch (lpServiceStatus->dwCurrentState)
+        {
+        case SERVICE_STOPPED:
+            SetLastError(ERROR_SERVICE_NOT_ACTIVE);
+            return FALSE;
+        case SERVICE_START_PENDING:
+            if (dwControl==SERVICE_CONTROL_STOP)
+                break;
+            /* fall thru */
+        case SERVICE_STOP_PENDING:
+            SetLastError(ERROR_SERVICE_CANNOT_ACCEPT_CTRL);
+            return FALSE;
+        }
     }
 
     handle = service_open_pipe(hsvc->name);




More information about the wine-cvs mailing list