- Implement RCreateServiceA.
[reactos.git] / reactos / dll / win32 / advapi32 / service / sctrl.c
index 3daac1f..3094951 100644 (file)
@@ -237,7 +237,7 @@ ScConnectControlPipe(HANDLE *hPipe)
                          NULL);
     if (*hPipe == INVALID_HANDLE_VALUE)
     {
-        ERR("CreateFileW() failed (Error %lu)\n", GetLastError());
+        ERR("CreateFileW() failed for pipe %S (Error %lu)\n", NtControlPipeName, GetLastError());
         return ERROR_FAILED_SERVICE_CONTROLLER_CONNECT;
     }
 
@@ -274,7 +274,7 @@ ScStartService(PSCM_CONTROL_PACKET ControlPacket)
     TRACE("Size: %lu\n", ControlPacket->dwSize);
     TRACE("Service: %S\n", &ControlPacket->szArguments[0]);
 
-    lpService = (PACTIVE_SERVICE)(ULONG_PTR)ControlPacket->hClient;
+    lpService = (PACTIVE_SERVICE)ControlPacket->hClient;
     if (lpService == NULL)
     {
         TRACE("Service not found\n");
@@ -317,7 +317,7 @@ ScControlService(PSCM_CONTROL_PACKET ControlPacket)
     TRACE("Size: %lu\n", ControlPacket->dwSize);
     TRACE("Service: %S\n", &ControlPacket->szArguments[0]);
 
-    lpService = (PACTIVE_SERVICE)(ULONG_PTR)ControlPacket->hClient;
+    lpService = (PACTIVE_SERVICE)ControlPacket->hClient;
     if (lpService == NULL)
     {
         TRACE("Service not found\n");
@@ -395,7 +395,8 @@ ScServiceDispatcher(HANDLE hPipe,
                 break;
 
             default:
-                TRACE("Unknown command %lu", ControlPacket->dwControl);
+                TRACE("Command %lu received", ControlPacket->dwControl);
+                ScControlService(ControlPacket);
                 continue;
         }
 
@@ -519,7 +520,7 @@ RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName,
     Service->HandlerFunctionEx = lpHandlerProc;
     Service->HandlerContext = lpContext;
 
-    TRACE("RegisterServiceCtrlHandlerEx returning %lu", Service->hService);
+    TRACE("RegisterServiceCtrlHandlerEx returning %lu\n", Service->hService);
 
     return (SERVICE_STATUS_HANDLE)Service->hService;
 }