mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 21:38:43 +00:00
Convert offset to pointers when enumeration functions return ERROR_SUCCESS or ERROR_MORE_DATA because there is something to convert in both cases.
svn path=/trunk/; revision=45459
This commit is contained in:
parent
fb88430110
commit
b5f68e4981
1 changed files with 74 additions and 73 deletions
|
@ -820,6 +820,23 @@ EnumDependentServicesA(SC_HANDLE hService,
|
|||
}
|
||||
RpcEndExcept;
|
||||
|
||||
if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices;
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
if (lpStatusPtr->lpServiceName)
|
||||
lpStatusPtr->lpServiceName =
|
||||
(LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName);
|
||||
|
||||
if (lpStatusPtr->lpDisplayName)
|
||||
lpStatusPtr->lpDisplayName =
|
||||
(LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName);
|
||||
|
||||
lpStatusPtr++;
|
||||
}
|
||||
}
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("REnumDependentServicesA() failed (Error %lu)\n", dwError);
|
||||
|
@ -827,20 +844,6 @@ EnumDependentServicesA(SC_HANDLE hService,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices;
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
if (lpStatusPtr->lpServiceName)
|
||||
lpStatusPtr->lpServiceName =
|
||||
(LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName);
|
||||
|
||||
if (lpStatusPtr->lpDisplayName)
|
||||
lpStatusPtr->lpDisplayName =
|
||||
(LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName);
|
||||
|
||||
lpStatusPtr++;
|
||||
}
|
||||
|
||||
TRACE("EnumDependentServicesA() done\n");
|
||||
|
||||
return TRUE;
|
||||
|
@ -881,6 +884,23 @@ EnumDependentServicesW(SC_HANDLE hService,
|
|||
}
|
||||
RpcEndExcept;
|
||||
|
||||
if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices;
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
if (lpStatusPtr->lpServiceName)
|
||||
lpStatusPtr->lpServiceName =
|
||||
(LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName);
|
||||
|
||||
if (lpStatusPtr->lpDisplayName)
|
||||
lpStatusPtr->lpDisplayName =
|
||||
(LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName);
|
||||
|
||||
lpStatusPtr++;
|
||||
}
|
||||
}
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("REnumDependentServicesW() failed (Error %lu)\n", dwError);
|
||||
|
@ -888,20 +908,6 @@ EnumDependentServicesW(SC_HANDLE hService,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices;
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
if (lpStatusPtr->lpServiceName)
|
||||
lpStatusPtr->lpServiceName =
|
||||
(LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName);
|
||||
|
||||
if (lpStatusPtr->lpDisplayName)
|
||||
lpStatusPtr->lpDisplayName =
|
||||
(LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName);
|
||||
|
||||
lpStatusPtr++;
|
||||
}
|
||||
|
||||
TRACE("EnumDependentServicesW() done\n");
|
||||
|
||||
return TRUE;
|
||||
|
@ -1012,6 +1018,23 @@ EnumServicesStatusA(SC_HANDLE hSCManager,
|
|||
}
|
||||
RpcEndExcept;
|
||||
|
||||
if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices;
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
if (lpStatusPtr->lpServiceName)
|
||||
lpStatusPtr->lpServiceName =
|
||||
(LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName);
|
||||
|
||||
if (lpStatusPtr->lpDisplayName)
|
||||
lpStatusPtr->lpDisplayName =
|
||||
(LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName);
|
||||
|
||||
lpStatusPtr++;
|
||||
}
|
||||
}
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("REnumServicesStatusA() failed (Error %lu)\n", dwError);
|
||||
|
@ -1019,20 +1042,6 @@ EnumServicesStatusA(SC_HANDLE hSCManager,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices;
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
if (lpStatusPtr->lpServiceName)
|
||||
lpStatusPtr->lpServiceName =
|
||||
(LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName);
|
||||
|
||||
if (lpStatusPtr->lpDisplayName)
|
||||
lpStatusPtr->lpDisplayName =
|
||||
(LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName);
|
||||
|
||||
lpStatusPtr++;
|
||||
}
|
||||
|
||||
TRACE("EnumServicesStatusA() done\n");
|
||||
|
||||
return TRUE;
|
||||
|
@ -1083,6 +1092,23 @@ EnumServicesStatusW(SC_HANDLE hSCManager,
|
|||
}
|
||||
RpcEndExcept;
|
||||
|
||||
if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices;
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
if (lpStatusPtr->lpServiceName)
|
||||
lpStatusPtr->lpServiceName =
|
||||
(LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName);
|
||||
|
||||
if (lpStatusPtr->lpDisplayName)
|
||||
lpStatusPtr->lpDisplayName =
|
||||
(LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName);
|
||||
|
||||
lpStatusPtr++;
|
||||
}
|
||||
}
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("REnumServicesStatusW() failed (Error %lu)\n", dwError);
|
||||
|
@ -1090,20 +1116,6 @@ EnumServicesStatusW(SC_HANDLE hSCManager,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices;
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
{
|
||||
if (lpStatusPtr->lpServiceName)
|
||||
lpStatusPtr->lpServiceName =
|
||||
(LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName);
|
||||
|
||||
if (lpStatusPtr->lpDisplayName)
|
||||
lpStatusPtr->lpDisplayName =
|
||||
(LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName);
|
||||
|
||||
lpStatusPtr++;
|
||||
}
|
||||
|
||||
TRACE("EnumServicesStatusW() done\n");
|
||||
|
||||
return TRUE;
|
||||
|
@ -1145,7 +1157,6 @@ EnumServicesStatusExA(SC_HANDLE hSCManager,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
RpcTryExcept
|
||||
{
|
||||
dwError = REnumServicesStatusExA((SC_RPC_HANDLE)hSCManager,
|
||||
|
@ -1165,13 +1176,7 @@ EnumServicesStatusExA(SC_HANDLE hSCManager,
|
|||
}
|
||||
RpcEndExcept;
|
||||
|
||||
if (dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
WARN("Required buffer size %ul\n", *pcbBytesNeeded);
|
||||
SetLastError(dwError);
|
||||
return FALSE;
|
||||
}
|
||||
else if (dwError == ERROR_SUCCESS)
|
||||
if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
lpStatusPtr = (LPENUM_SERVICE_STATUS_PROCESSA)lpServices;
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
|
@ -1187,7 +1192,8 @@ EnumServicesStatusExA(SC_HANDLE hSCManager,
|
|||
lpStatusPtr++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("REnumServicesStatusExA() failed (Error %lu)\n", dwError);
|
||||
SetLastError(dwError);
|
||||
|
@ -1242,13 +1248,7 @@ EnumServicesStatusExW(SC_HANDLE hSCManager,
|
|||
}
|
||||
RpcEndExcept;
|
||||
|
||||
if (dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
WARN("Required buffer size %ul\n", *pcbBytesNeeded);
|
||||
SetLastError(dwError);
|
||||
return FALSE;
|
||||
}
|
||||
else if (dwError == ERROR_SUCCESS)
|
||||
if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA)
|
||||
{
|
||||
lpStatusPtr = (LPENUM_SERVICE_STATUS_PROCESSW)lpServices;
|
||||
for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++)
|
||||
|
@ -1264,7 +1264,8 @@ EnumServicesStatusExW(SC_HANDLE hSCManager,
|
|||
lpStatusPtr++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("REnumServicesStatusExW() failed (Error %lu)\n", dwError);
|
||||
SetLastError(dwError);
|
||||
|
|
Loading…
Reference in a new issue