[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:
Eric Kohl 2011-03-19 19:14:53 +00:00
parent fb3cc815f7
commit 80b43e7b13

View file

@ -4558,18 +4558,21 @@ 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) if (dwError != ERROR_SUCCESS && dwError != ERROR_FILE_NOT_FOUND)
{ goto done;
*pcbBytesNeeded += ((wcslen(lpDescriptionW) + 1) * sizeof(WCHAR));
}
if (cbBufSize >= *pcbBytesNeeded) *pcbBytesNeeded = sizeof(SERVICE_DESCRIPTIONA);
if (dwError == ERROR_SUCCESS)
*pcbBytesNeeded += ((wcslen(lpDescriptionW) + 1) * sizeof(WCHAR));
if (cbBufSize < *pcbBytesNeeded)
{ {
dwError = ERROR_INSUFFICIENT_BUFFER;
goto done;
}
if (dwError == ERROR_SUCCESS) if (dwError == ERROR_SUCCESS)
{ {
@ -4588,12 +4591,7 @@ DWORD RQueryServiceConfig2A(
else else
{ {
lpServiceDescription->lpDescription = NULL; lpServiceDescription->lpDescription = NULL;
goto done; dwError = ERROR_SUCCESS;
}
}
else
{
dwError = ERROR_INSUFFICIENT_BUFFER;
goto done; goto done;
} }
} }
@ -4681,22 +4679,31 @@ 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;
} }
if (dwError == ERROR_SUCCESS)
{
lpStr = (LPWSTR)(lpServiceDescription + 1); lpStr = (LPWSTR)(lpServiceDescription + 1);
wcscpy(lpStr, lpDescription); wcscpy(lpStr, lpDescription);
lpServiceDescription->lpDescription = (LPWSTR)((ULONG_PTR)lpStr - (ULONG_PTR)lpServiceDescription); 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)
{ {
LPWSTR lpStr; LPWSTR lpStr;