Author: ekohl
Date: Sun Sep 21 10:19:52 2008
New Revision: 36383
URL:
http://svn.reactos.org/svn/reactos?rev=36383&view=rev
Log:
EnumDependentServicesA/W and EnumServicesStatusA/W don't fix up pointers if the
service manager returns an error.
This fixes bug #3737.
Patch by Michael Martin aka bugboy <martinmnet(a)hotmail.com>om>.
Modified:
trunk/reactos/dll/win32/advapi32/service/scm.c
Modified: trunk/reactos/dll/win32/advapi32/service/scm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/service/scm.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/service/scm.c [iso-8859-1] Sun Sep 21 10:19:52 2008
@@ -801,6 +801,13 @@
}
_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++)
{
@@ -813,13 +820,6 @@
(LPSTR)((ULONG_PTR)lpServices +
(ULONG_PTR)lpStatusPtr->lpDisplayName);
lpStatusPtr++;
- }
-
- if (dwError != ERROR_SUCCESS)
- {
- ERR("REnumDependentServicesA() failed (Error %lu)\n", dwError);
- SetLastError(dwError);
- return FALSE;
}
TRACE("EnumDependentServicesA() done\n");
@@ -865,6 +865,13 @@
}
_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++)
{
@@ -877,13 +884,6 @@
(LPWSTR)((ULONG_PTR)lpServices +
(ULONG_PTR)lpStatusPtr->lpDisplayName);
lpStatusPtr++;
- }
-
- if (dwError != ERROR_SUCCESS)
- {
- ERR("REnumDependentServicesW() failed (Error %lu)\n", dwError);
- SetLastError(dwError);
- return FALSE;
}
TRACE("EnumDependentServicesW() done\n");
@@ -957,6 +957,13 @@
}
_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++)
{
@@ -969,13 +976,6 @@
(LPSTR)((ULONG_PTR)lpServices +
(ULONG_PTR)lpStatusPtr->lpDisplayName);
lpStatusPtr++;
- }
-
- if (dwError != ERROR_SUCCESS)
- {
- ERR("REnumServicesStatusA() failed (Error %lu)\n", dwError);
- SetLastError(dwError);
- return FALSE;
}
TRACE("EnumServicesStatusA() done\n");
@@ -1025,6 +1025,13 @@
}
_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++)
{
@@ -1037,13 +1044,6 @@
(LPWSTR)((ULONG_PTR)lpServices +
(ULONG_PTR)lpStatusPtr->lpDisplayName);
lpStatusPtr++;
- }
-
- if (dwError != ERROR_SUCCESS)
- {
- ERR("REnumServicesStatusW() failed (Error %lu)\n", dwError);
- SetLastError(dwError);
- return FALSE;
}
TRACE("EnumServicesStatusW() done\n");