mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 08:52:57 +00:00
[SERVICES]
RQueryServiceConfig2A/W must return ERROR_SUCCESS if the Description value of a service does not exist. This fixes a winetest failure. svn path=/trunk/; revision=51092
This commit is contained in:
parent
fb3cc815f7
commit
80b43e7b13
1 changed files with 38 additions and 31 deletions
|
@ -4558,42 +4558,40 @@ DWORD RQueryServiceConfig2A(
|
||||||
LPSERVICE_DESCRIPTIONA lpServiceDescription = (LPSERVICE_DESCRIPTIONA)lpBuffer;
|
LPSERVICE_DESCRIPTIONA lpServiceDescription = (LPSERVICE_DESCRIPTIONA)lpBuffer;
|
||||||
LPSTR lpStr;
|
LPSTR lpStr;
|
||||||
|
|
||||||
*pcbBytesNeeded = sizeof(SERVICE_DESCRIPTIONA);
|
|
||||||
|
|
||||||
dwError = ScmReadString(hServiceKey,
|
dwError = ScmReadString(hServiceKey,
|
||||||
L"Description",
|
L"Description",
|
||||||
&lpDescriptionW);
|
&lpDescriptionW);
|
||||||
|
if (dwError != ERROR_SUCCESS && dwError != ERROR_FILE_NOT_FOUND)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
*pcbBytesNeeded = sizeof(SERVICE_DESCRIPTIONA);
|
||||||
if (dwError == ERROR_SUCCESS)
|
if (dwError == ERROR_SUCCESS)
|
||||||
{
|
|
||||||
*pcbBytesNeeded += ((wcslen(lpDescriptionW) + 1) * sizeof(WCHAR));
|
*pcbBytesNeeded += ((wcslen(lpDescriptionW) + 1) * sizeof(WCHAR));
|
||||||
|
|
||||||
|
if (cbBufSize < *pcbBytesNeeded)
|
||||||
|
{
|
||||||
|
dwError = ERROR_INSUFFICIENT_BUFFER;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cbBufSize >= *pcbBytesNeeded)
|
if (dwError == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
lpStr = (LPSTR)(lpServiceDescription + 1);
|
||||||
|
|
||||||
if (dwError == ERROR_SUCCESS)
|
WideCharToMultiByte(CP_ACP,
|
||||||
{
|
0,
|
||||||
lpStr = (LPSTR)(lpServiceDescription + 1);
|
lpDescriptionW,
|
||||||
|
-1,
|
||||||
WideCharToMultiByte(CP_ACP,
|
lpStr,
|
||||||
0,
|
wcslen(lpDescriptionW),
|
||||||
lpDescriptionW,
|
NULL,
|
||||||
-1,
|
NULL);
|
||||||
lpStr,
|
lpServiceDescription->lpDescription = (LPSTR)((ULONG_PTR)lpStr - (ULONG_PTR)lpServiceDescription);
|
||||||
wcslen(lpDescriptionW),
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
lpServiceDescription->lpDescription = (LPSTR)((ULONG_PTR)lpStr - (ULONG_PTR)lpServiceDescription);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lpServiceDescription->lpDescription = NULL;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dwError = ERROR_INSUFFICIENT_BUFFER;
|
lpServiceDescription->lpDescription = NULL;
|
||||||
|
dwError = ERROR_SUCCESS;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4681,21 +4679,30 @@ DWORD RQueryServiceConfig2W(
|
||||||
dwError = ScmReadString(hServiceKey,
|
dwError = ScmReadString(hServiceKey,
|
||||||
L"Description",
|
L"Description",
|
||||||
&lpDescription);
|
&lpDescription);
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS && dwError != ERROR_FILE_NOT_FOUND)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
dwRequiredSize = sizeof(SERVICE_DESCRIPTIONW) + ((wcslen(lpDescription) + 1) * sizeof(WCHAR));
|
*pcbBytesNeeded = sizeof(SERVICE_DESCRIPTIONW);
|
||||||
|
if (dwError == ERROR_SUCCESS)
|
||||||
|
*pcbBytesNeeded += ((wcslen(lpDescription) + 1) * sizeof(WCHAR));
|
||||||
|
|
||||||
if (cbBufSize < dwRequiredSize)
|
if (cbBufSize < *pcbBytesNeeded)
|
||||||
{
|
{
|
||||||
*pcbBytesNeeded = dwRequiredSize;
|
|
||||||
dwError = ERROR_INSUFFICIENT_BUFFER;
|
dwError = ERROR_INSUFFICIENT_BUFFER;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
lpStr = (LPWSTR)(lpServiceDescription + 1);
|
if (dwError == ERROR_SUCCESS)
|
||||||
wcscpy(lpStr, lpDescription);
|
{
|
||||||
lpServiceDescription->lpDescription = (LPWSTR)((ULONG_PTR)lpStr - (ULONG_PTR)lpServiceDescription);
|
lpStr = (LPWSTR)(lpServiceDescription + 1);
|
||||||
|
wcscpy(lpStr, lpDescription);
|
||||||
|
lpServiceDescription->lpDescription = (LPWSTR)((ULONG_PTR)lpStr - (ULONG_PTR)lpServiceDescription);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lpServiceDescription->lpDescription = NULL;
|
||||||
|
dwError = ERROR_SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (dwInfoLevel == SERVICE_CONFIG_FAILURE_ACTIONS)
|
else if (dwInfoLevel == SERVICE_CONFIG_FAILURE_ACTIONS)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue