mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[NET] Properly check return value of EnumServicesStatusW on first call
This commit is contained in:
committed by
Jérôme Gardou
parent
5aafeb473f
commit
6bf64780e4
@@ -23,6 +23,7 @@ EnumerateRunningServices(VOID)
|
||||
INT i;
|
||||
INT nError = 0;
|
||||
DWORD dwError = ERROR_SUCCESS;
|
||||
BOOL ret;
|
||||
|
||||
hManager = OpenSCManagerW(NULL,
|
||||
SERVICES_ACTIVE_DATABASE,
|
||||
@@ -34,14 +35,22 @@ EnumerateRunningServices(VOID)
|
||||
goto done;
|
||||
}
|
||||
|
||||
EnumServicesStatusW(hManager,
|
||||
SERVICE_WIN32,
|
||||
SERVICE_ACTIVE,
|
||||
NULL,
|
||||
0,
|
||||
&dwBufferSize,
|
||||
&dwServiceCount,
|
||||
&dwResumeHandle);
|
||||
ret = EnumServicesStatusW(hManager,
|
||||
SERVICE_WIN32,
|
||||
SERVICE_ACTIVE,
|
||||
NULL,
|
||||
0,
|
||||
&dwBufferSize,
|
||||
&dwServiceCount,
|
||||
&dwResumeHandle);
|
||||
if (ret)
|
||||
{
|
||||
/* Nothing to enumerate ?! */
|
||||
goto done;
|
||||
}
|
||||
dwError = GetLastError();
|
||||
if (dwError != ERROR_INSUFFICIENT_BUFFER)
|
||||
goto done;
|
||||
|
||||
if (dwBufferSize != 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user