[advapi32/service #2] Fix buffersize calculations for
GetServiceDisplayNameA
Alexandre Julliard
julliard at winehq.org
Thu Jul 26 06:34:51 CDT 2007
Paul Vriens <paul.vriens.wine at gmail.com> writes:
> diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
> index 1ecaf70..7e4ac8e 100644
> --- a/dlls/advapi32/service.c
> +++ b/dlls/advapi32/service.c
> @@ -2298,7 +2298,7 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
> if (ret == ERROR_MORE_DATA)
> {
> SetLastError(ERROR_INSUFFICIENT_BUFFER);
> - *lpcchBuffer = size - 1;
> + *lpcchBuffer = (size - 1) * sizeof(WCHAR);
That's not correct, the A function is not supposed to return WCHARs.
What probably happens on Windows is that it calls the W function and
doubles the size as an upper bound on the buffer size.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list