Author: ekohl
Date: Sat Mar 19 19:14:53 2011
New Revision: 51092
URL:
http://svn.reactos.org/svn/reactos?rev=51092&view=rev
Log:
[SERVICES]
RQueryServiceConfig2A/W must return ERROR_SUCCESS if the Description value of a service
does not exist. This fixes a winetest failure.
Modified:
trunk/reactos/base/system/services/rpcserver.c
Modified: trunk/reactos/base/system/services/rpcserver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcse…
==============================================================================
--- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Sat Mar 19 19:14:53 2011
@@ -4558,42 +4558,40 @@
LPSERVICE_DESCRIPTIONA lpServiceDescription = (LPSERVICE_DESCRIPTIONA)lpBuffer;
LPSTR lpStr;
- *pcbBytesNeeded = sizeof(SERVICE_DESCRIPTIONA);
-
dwError = ScmReadString(hServiceKey,
L"Description",
&lpDescriptionW);
+ if (dwError != ERROR_SUCCESS && dwError != ERROR_FILE_NOT_FOUND)
+ goto done;
+
+ *pcbBytesNeeded = sizeof(SERVICE_DESCRIPTIONA);
if (dwError == ERROR_SUCCESS)
- {
*pcbBytesNeeded += ((wcslen(lpDescriptionW) + 1) * sizeof(WCHAR));
- }
-
- if (cbBufSize >= *pcbBytesNeeded)
- {
-
- if (dwError == ERROR_SUCCESS)
- {
- lpStr = (LPSTR)(lpServiceDescription + 1);
-
- WideCharToMultiByte(CP_ACP,
- 0,
- lpDescriptionW,
- -1,
- lpStr,
- wcslen(lpDescriptionW),
- NULL,
- NULL);
- lpServiceDescription->lpDescription = (LPSTR)((ULONG_PTR)lpStr -
(ULONG_PTR)lpServiceDescription);
- }
- else
- {
- lpServiceDescription->lpDescription = NULL;
- goto done;
- }
+
+ if (cbBufSize < *pcbBytesNeeded)
+ {
+ dwError = ERROR_INSUFFICIENT_BUFFER;
+ goto done;
+ }
+
+ if (dwError == ERROR_SUCCESS)
+ {
+ lpStr = (LPSTR)(lpServiceDescription + 1);
+
+ WideCharToMultiByte(CP_ACP,
+ 0,
+ lpDescriptionW,
+ -1,
+ lpStr,
+ wcslen(lpDescriptionW),
+ NULL,
+ NULL);
+ lpServiceDescription->lpDescription = (LPSTR)((ULONG_PTR)lpStr -
(ULONG_PTR)lpServiceDescription);
}
else
{
- dwError = ERROR_INSUFFICIENT_BUFFER;
+ lpServiceDescription->lpDescription = NULL;
+ dwError = ERROR_SUCCESS;
goto done;
}
}
@@ -4681,21 +4679,30 @@
dwError = ScmReadString(hServiceKey,
L"Description",
&lpDescription);
- if (dwError != ERROR_SUCCESS)
+ if (dwError != ERROR_SUCCESS && dwError != ERROR_FILE_NOT_FOUND)
goto done;
- dwRequiredSize = sizeof(SERVICE_DESCRIPTIONW) + ((wcslen(lpDescription) + 1) *
sizeof(WCHAR));
-
- if (cbBufSize < dwRequiredSize)
- {
- *pcbBytesNeeded = dwRequiredSize;
+ *pcbBytesNeeded = sizeof(SERVICE_DESCRIPTIONW);
+ if (dwError == ERROR_SUCCESS)
+ *pcbBytesNeeded += ((wcslen(lpDescription) + 1) * sizeof(WCHAR));
+
+ if (cbBufSize < *pcbBytesNeeded)
+ {
dwError = ERROR_INSUFFICIENT_BUFFER;
goto done;
}
- lpStr = (LPWSTR)(lpServiceDescription + 1);
- wcscpy(lpStr, lpDescription);
- lpServiceDescription->lpDescription = (LPWSTR)((ULONG_PTR)lpStr -
(ULONG_PTR)lpServiceDescription);
+ if (dwError == ERROR_SUCCESS)
+ {
+ 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)
{