EnumDependentServicesA/W and EnumServicesStatusA/W don't fix up pointers if the servi...
authorEric Kohl <eric.kohl@reactos.org>
Sun, 21 Sep 2008 15:19:52 +0000 (15:19 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 21 Sep 2008 15:19:52 +0000 (15:19 +0000)
This fixes bug #3737.
Patch by Michael Martin aka bugboy <martinmnet@hotmail.com>.

svn path=/trunk/; revision=36383

reactos/dll/win32/advapi32/service/scm.c

index a47c620..111bd0a 100644 (file)
@@ -801,6 +801,13 @@ EnumDependentServicesA(SC_HANDLE hService,
     }
     _SEH_END;
 
+    if (dwError != ERROR_SUCCESS)
+    {
+        ERR("REnumDependentServicesA() failed (Error %lu)\n", dwError);
+        SetLastError(dwError);
+        return FALSE;
+    }
+
     lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices;
     for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
     {
@@ -815,13 +822,6 @@ EnumDependentServicesA(SC_HANDLE hService,
         lpStatusPtr++;
     }
 
-    if (dwError != ERROR_SUCCESS)
-    {
-        ERR("REnumDependentServicesA() failed (Error %lu)\n", dwError);
-        SetLastError(dwError);
-        return FALSE;
-    }
-
     TRACE("EnumDependentServicesA() done\n");
 
     return TRUE;
@@ -865,6 +865,13 @@ EnumDependentServicesW(SC_HANDLE hService,
     }
     _SEH_END;
 
+    if (dwError != ERROR_SUCCESS)
+    {
+        ERR("REnumDependentServicesW() failed (Error %lu)\n", dwError);
+        SetLastError(dwError);
+        return FALSE;
+    }
+
     lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices;
     for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
     {
@@ -879,13 +886,6 @@ EnumDependentServicesW(SC_HANDLE hService,
         lpStatusPtr++;
     }
 
-    if (dwError != ERROR_SUCCESS)
-    {
-        ERR("REnumDependentServicesW() failed (Error %lu)\n", dwError);
-        SetLastError(dwError);
-        return FALSE;
-    }
-
     TRACE("EnumDependentServicesW() done\n");
 
     return TRUE;
@@ -957,6 +957,13 @@ EnumServicesStatusA(SC_HANDLE hSCManager,
     }
     _SEH_END;
 
+    if (dwError != ERROR_SUCCESS)
+    {
+        ERR("REnumServicesStatusA() failed (Error %lu)\n", dwError);
+        SetLastError(dwError);
+        return FALSE;
+    }
+
     lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices;
     for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
     {
@@ -971,13 +978,6 @@ EnumServicesStatusA(SC_HANDLE hSCManager,
         lpStatusPtr++;
     }
 
-    if (dwError != ERROR_SUCCESS)
-    {
-        ERR("REnumServicesStatusA() failed (Error %lu)\n", dwError);
-        SetLastError(dwError);
-        return FALSE;
-    }
-
     TRACE("EnumServicesStatusA() done\n");
 
     return TRUE;
@@ -1025,6 +1025,13 @@ EnumServicesStatusW(SC_HANDLE hSCManager,
     }
     _SEH_END;
 
+    if (dwError != ERROR_SUCCESS)
+    {
+        ERR("REnumServicesStatusW() failed (Error %lu)\n", dwError);
+        SetLastError(dwError);
+        return FALSE;
+    }
+
     lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices;
     for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
     {
@@ -1039,13 +1046,6 @@ EnumServicesStatusW(SC_HANDLE hSCManager,
         lpStatusPtr++;
     }
 
-    if (dwError != ERROR_SUCCESS)
-    {
-        ERR("REnumServicesStatusW() failed (Error %lu)\n", dwError);
-        SetLastError(dwError);
-        return FALSE;
-    }
-
     TRACE("EnumServicesStatusW() done\n");
 
     return TRUE;