[advapi32/service #2] Fix buffersize calculations for GetServiceDisplayNameA

Paul Vriens paul.vriens.wine at gmail.com
Thu Jul 26 06:40:08 CDT 2007


Alexandre Julliard wrote:
> 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.
> 
So how do you suggest I'm going to fix this? Maybe we should call the W function 
as well as deal with the differences?

Cheers,

Paul.



More information about the wine-devel mailing list