mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:53:06 +00:00
[SERVICES]
Code cleaning and removing bugs. Patch by Hermès Bélusca. I did not include the changes to EnumServicesStatusW because it does not improve the code but introduces an unnecessary exception. See issue #7127 for more details. svn path=/trunk/; revision=56763
This commit is contained in:
parent
aa5e222460
commit
490c8a5648
1 changed files with 48 additions and 93 deletions
|
@ -776,8 +776,6 @@ EnumDependentServicesA(SC_HANDLE hService,
|
|||
RpcEndExcept;
|
||||
|
||||
if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
if (*lpServicesReturned > 0)
|
||||
{
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
|
@ -792,7 +790,6 @@ EnumDependentServicesA(SC_HANDLE hService,
|
|||
lpStatusPtr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
|
@ -855,8 +852,6 @@ EnumDependentServicesW(SC_HANDLE hService,
|
|||
RpcEndExcept;
|
||||
|
||||
if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
if (*lpServicesReturned > 0)
|
||||
{
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
|
@ -871,7 +866,6 @@ EnumDependentServicesW(SC_HANDLE hService,
|
|||
lpStatusPtr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
|
@ -960,8 +954,6 @@ EnumServiceGroupW(SC_HANDLE hSCManager,
|
|||
RpcEndExcept;
|
||||
|
||||
if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
if (*lpServicesReturned > 0)
|
||||
{
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
|
@ -976,7 +968,6 @@ EnumServiceGroupW(SC_HANDLE hSCManager,
|
|||
lpStatusPtr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
|
@ -1020,46 +1011,10 @@ EnumServicesStatusA(SC_HANDLE hSCManager,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (dwServiceType != SERVICE_DRIVER && dwServiceType != SERVICE_WIN32)
|
||||
{
|
||||
if (pcbBytesNeeded && lpServicesReturned)
|
||||
{
|
||||
*pcbBytesNeeded = 0;
|
||||
*lpServicesReturned = 0;
|
||||
}
|
||||
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (dwServiceState != SERVICE_ACTIVE && dwServiceState != SERVICE_INACTIVE && dwServiceState != SERVICE_STATE_ALL)
|
||||
{
|
||||
if (pcbBytesNeeded)
|
||||
*pcbBytesNeeded = 0;
|
||||
|
||||
if (lpServicesReturned)
|
||||
*lpServicesReturned = 0;
|
||||
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!pcbBytesNeeded || !lpServicesReturned)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_ADDRESS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!lpServices && cbBufSize != 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_ADDRESS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSW))
|
||||
if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSA))
|
||||
{
|
||||
lpStatusPtr = &ServiceStatus;
|
||||
dwBufferSize = sizeof(ENUM_SERVICE_STATUSW);
|
||||
dwBufferSize = sizeof(ENUM_SERVICE_STATUSA);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1085,8 +1040,6 @@ EnumServicesStatusA(SC_HANDLE hSCManager,
|
|||
RpcEndExcept;
|
||||
|
||||
if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
if (*lpServicesReturned > 0)
|
||||
{
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
|
@ -1101,7 +1054,6 @@ EnumServicesStatusA(SC_HANDLE hSCManager,
|
|||
lpStatusPtr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
|
@ -1174,8 +1126,6 @@ EnumServicesStatusW(SC_HANDLE hSCManager,
|
|||
RpcEndExcept;
|
||||
|
||||
if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
if (*lpServicesReturned > 0)
|
||||
{
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
|
@ -1190,7 +1140,6 @@ EnumServicesStatusW(SC_HANDLE hSCManager,
|
|||
lpStatusPtr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
|
@ -1336,6 +1285,12 @@ EnumServicesStatusExW(SC_HANDLE hSCManager,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!hSCManager)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (lpServices == NULL ||
|
||||
cbBufSize < sizeof(ENUM_SERVICE_STATUS_PROCESSW))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue