[ADVAPI32] Take into account the service handler context when dispatching a control...
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 25 Feb 2018 17:53:05 +0000 (18:53 +0100)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 25 Feb 2018 23:36:57 +0000 (00:36 +0100)
dll/win32/advapi32/service/scm.c
dll/win32/advapi32/service/sctrl.c

index ec1b84c..5a20508 100644 (file)
@@ -10,7 +10,7 @@
 /* INCLUDES ******************************************************************/
 
 #include <advapi32.h>
 /* INCLUDES ******************************************************************/
 
 #include <advapi32.h>
-WINE_DEFAULT_DEBUG_CHANNEL(advapi);
+WINE_DEFAULT_DEBUG_CHANNEL(advapi_service);
 
 
 /* FUNCTIONS *****************************************************************/
 
 
 /* FUNCTIONS *****************************************************************/
index fe24697..5afa8df 100644 (file)
@@ -12,7 +12,7 @@
 /* INCLUDES ******************************************************************/
 
 #include <advapi32.h>
 /* INCLUDES ******************************************************************/
 
 #include <advapi32.h>
-WINE_DEFAULT_DEBUG_CHANNEL(advapi);
+WINE_DEFAULT_DEBUG_CHANNEL(advapi_service);
 
 
 /* TYPES *********************************************************************/
 
 
 /* TYPES *********************************************************************/
@@ -514,26 +514,31 @@ static DWORD
 ScControlService(PACTIVE_SERVICE lpService,
                  PSCM_CONTROL_PACKET ControlPacket)
 {
 ScControlService(PACTIVE_SERVICE lpService,
                  PSCM_CONTROL_PACKET ControlPacket)
 {
+    DWORD dwError;
+
     if (lpService == NULL || ControlPacket == NULL)
         return ERROR_INVALID_PARAMETER;
 
     if (lpService == NULL || ControlPacket == NULL)
         return ERROR_INVALID_PARAMETER;
 
-    TRACE("ScControlService() called\n");
-    TRACE("Size: %lu\n", ControlPacket->dwSize);
-    TRACE("Service: %S\n", (PWSTR)((PBYTE)ControlPacket + ControlPacket->dwServiceNameOffset));
+    TRACE("ScControlService(Size: %lu, Service: '%S') called\n",
+          ControlPacket->dwSize,
+          (PWSTR)((ULONG_PTR)ControlPacket + ControlPacket->dwServiceNameOffset));
 
     if (lpService->HandlerFunction)
     {
         (lpService->HandlerFunction)(ControlPacket->dwControl);
 
     if (lpService->HandlerFunction)
     {
         (lpService->HandlerFunction)(ControlPacket->dwControl);
+        dwError = ERROR_SUCCESS;
     }
     else if (lpService->HandlerFunctionEx)
     {
     }
     else if (lpService->HandlerFunctionEx)
     {
-        /* FIXME: send correct params */
-        (lpService->HandlerFunctionEx)(ControlPacket->dwControl, 0, NULL, NULL);
+        /* FIXME: Send correct 2nd and 3rd parameters */
+        dwError = (lpService->HandlerFunctionEx)(ControlPacket->dwControl,
+                                                 0, NULL,
+                                                 lpService->HandlerContext);
     }
 
     }
 
-    TRACE("ScControlService() done\n");
+    TRACE("ScControlService() done (error %lu)\n", dwError);
 
 
-    return ERROR_SUCCESS;
+    return dwError;
 }
 
 
 }