Addendum to r68248
[reactos.git] / reactos / win32ss / printing / base / spoolsv / main.c
index 1b00de0..8e25b36 100644 (file)
@@ -59,19 +59,27 @@ _ServiceMain(DWORD dwArgc, LPWSTR* lpszArgv)
     _UpdateServiceStatus(SERVICE_START_PENDING, 0);
 
     // Create a thread for serving RPC requests
-    hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)RpcThreadProc, NULL, 0, NULL);
-
-    if (hThread)
+    hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)LrpcThreadProc, NULL, 0, NULL);
+    if (!hThread)
     {
-        // We don't need the thread handle. Keeping it open blocks the thread from terminating.
-        CloseHandle(hThread);
-        _UpdateServiceStatus(SERVICE_RUNNING, 0);
+        ERR("CreateThread failed with error %u!\n", GetLastError());
+        _UpdateServiceStatus(SERVICE_STOPPED, 0);
+        return;
     }
-    else
+
+    // We don't need the thread handle. Keeping it open blocks the thread from terminating.
+    CloseHandle(hThread);
+
+    // Initialize the routing layer in spoolss.dll
+    if (!InitializeRouter(hServiceStatus))
     {
-        ERR("CreateThread failed with error %u!\n", GetLastError());
+        ERR("InitializeRouter failed with error %lu!\n", GetLastError());
         _UpdateServiceStatus(SERVICE_STOPPED, 0);
+        return;
     }
+
+    // We're alive!
+    _UpdateServiceStatus(SERVICE_RUNNING, 0);
 }
 
 int