[ros-diffs] [ekohl] 53036: [SERVICES] - If a service will be started and another service is already running in the same image, send a start command instead of starting the process again. This enables us to run...

ekohl at svn.reactos.org ekohl at svn.reactos.org
Tue Aug 2 20:37:48 UTC 2011


Author: ekohl
Date: Tue Aug  2 20:37:48 2011
New Revision: 53036

URL: http://svn.reactos.org/svn/reactos?rev=53036&view=rev
Log:
[SERVICES]
- If a service will be started and another service is already running in the same image, send a start command instead of starting the process again.
This enables us to run multiple services within a single process, like svchost.exe.

Modified:
    trunk/reactos/base/system/services/database.c

Modified: trunk/reactos/base/system/services/database.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/database.c?rev=53036&r1=53035&r2=53036&view=diff
==============================================================================
--- trunk/reactos/base/system/services/database.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/database.c [iso-8859-1] Tue Aug  2 20:37:48 2011
@@ -217,6 +217,8 @@
         /* Increment the run counter */
         pServiceImage->dwImageRunCount++;
     }
+
+    DPRINT("pServiceImage->dwImageRunCount: %lu\n", pServiceImage->dwImageRunCount);
 
     /* Link the service image to the service */
     pService->lpImage = pServiceImage;
@@ -1080,6 +1082,13 @@
     DWORD dwProcessId;
 
     DPRINT("ScmStartUserModeService(%p)\n", Service);
+
+    /* If the image is already running ... */
+    if (Service->lpImage->dwImageRunCount > 1)
+    {
+        /* ... just send a start command */
+        return ScmSendStartCommand(Service, argc, argv);
+    }
 
     StartupInfo.cb = sizeof(StartupInfo);
     StartupInfo.lpReserved = NULL;




More information about the Ros-diffs mailing list