Author: mturk
Date: Mon Dec 20 15:08:21 2010
New Revision: 1051138

URL: http://svn.apache.org/viewvc?rev=1051138&view=rev
Log:
DAEMON-190: Make sure we have default system dependent services

Modified:
    commons/proper/daemon/trunk/RELEASE-NOTES.txt
    commons/proper/daemon/trunk/src/native/windows/src/service.c

Modified: commons/proper/daemon/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/commons/proper/daemon/trunk/RELEASE-NOTES.txt?rev=1051138&r1=1051137&r2=1051138&view=diff
==============================================================================
--- commons/proper/daemon/trunk/RELEASE-NOTES.txt (original)
+++ commons/proper/daemon/trunk/RELEASE-NOTES.txt Mon Dec 20 15:08:21 2010
@@ -70,7 +70,7 @@ NEW FEATURES:
 
 BUG FIXES:
 
-1.0.5: DAEMON-188
+1.0.5: DAEMON-188, DAEMON-190
 
 1.0.4: DAEMON-95, DAEMON-171, DAEMON-100, DAEMON-164, DAEMON-165, DAEMON-175,
        DAEMON-177, DAEMON-150, DAEMON-163, DAEMON-182, DAEMON-181

Modified: commons/proper/daemon/trunk/src/native/windows/src/service.c
URL: 
http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/windows/src/service.c?rev=1051138&r1=1051137&r2=1051138&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/windows/src/service.c (original)
+++ commons/proper/daemon/trunk/src/native/windows/src/service.c Mon Dec 20 
15:08:21 2010
@@ -249,7 +249,7 @@ __apxStopDependentServices(LPAPXSERVICE 
     DWORD dwBytesNeeded;
     DWORD dwCount;
 
-    LPENUM_SERVICE_STATUS   lpDependencies = NULL;
+    LPENUM_SERVICE_STATUSW  lpDependencies = NULL;
     ENUM_SERVICE_STATUS     ess;
     SC_HANDLE               hDepService;
     SERVICE_STATUS_PROCESS  ssp;
@@ -260,11 +260,11 @@ __apxStopDependentServices(LPAPXSERVICE 
 
     /* Pass a zero-length buffer to get the required buffer size.
      */
-    if (EnumDependentServices(lpService->hService,
-                              SERVICE_ACTIVE,
-                              lpDependencies, 0,
-                              &dwBytesNeeded,
-                              &dwCount)) {
+    if (EnumDependentServicesW(lpService->hService,
+                               SERVICE_ACTIVE,
+                               lpDependencies, 0,
+                               &dwBytesNeeded,
+                               &dwCount)) {
          /* If the Enum call succeeds, then there are no dependent
           * services, so do nothing.
           */
@@ -284,24 +284,26 @@ __apxStopDependentServices(LPAPXSERVICE 
 
         __try {
             /* Enumerate the dependencies. */
-            if (!EnumDependentServices(lpService->hService,
-                                       SERVICE_ACTIVE,
-                                       lpDependencies,
-                                       dwBytesNeeded,
-                                      &dwBytesNeeded,
-                                      &dwCount))
+            if (!EnumDependentServicesW(lpService->hService,
+                                        SERVICE_ACTIVE,
+                                        lpDependencies,
+                                        dwBytesNeeded,
+                                        &dwBytesNeeded,
+                                        &dwCount))
             return FALSE;
 
             for (i = 0; i < dwCount; i++)  {
                 ess = *(lpDependencies + i);
                 /* Open the service. */
-                hDepService = OpenService(lpService->hManager,
-                                          ess.lpServiceName,
-                                          SERVICE_STOP | SERVICE_QUERY_STATUS);
+                hDepService = OpenServiceW(lpService->hManager,
+                                           ess.lpServiceName,
+                                           SERVICE_STOP | 
SERVICE_QUERY_STATUS);
 
                 if (!hDepService)
-                   return FALSE;
-
+                   continue;
+                if (lstrcmpiW(ess.lpServiceName, L"Tcpip") == 0 ||
+                    lstrcmpiW(ess.lpServiceName, L"Afd") == 0)
+                    continue;
                 __try {
                     /* Send a stop code. */
                     if (!ControlService(hDepService,
@@ -525,7 +527,7 @@ apxServiceInstall(APXHANDLE hService, LP
                                          szImagePath,
                                          NULL,
                                          NULL,
-                                         lpDependencies,
+                                         lpDependencies ? lpDependencies : 
L"Tcpip\0Afd\0",
                                          NULL,
                                          NULL);
 


Reply via email to