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

Paul Vriens paul.vriens.wine at gmail.com
Thu Jul 26 09:09:53 CDT 2007


Alexandre Julliard wrote:
> Paul Vriens <paul.vriens.wine at gmail.com> writes:
> 
>> I could of course leave the 'not-so-clean' way of setting the size out:
>>
>>     if (!lpDisplayName && lpcchBuffer && !ret && (GLE ==
>> ERROR_INSUFFICIENT_BUFFER))
>>     {
>>         /* Request for buffersize.
>>          *
>>          * Only set the size for ERROR_INSUFFICIENT_BUFFER
>>          */
>>         size = sizeW * sizeof(WCHAR);
>>     }
>>     else if (lpDisplayName && lpcchBuffer && !ret)
>>     {
>>         /* Request for displayname.
>>          *
>>          * size has to be set if this fails
>>          */
>>         size = sizeW * sizeof(WCHAR);
>>     }
> 
> This shouldn't be sizeof(WCHAR), it should be 2 as in "at most 2 A
> chars for each W char". Of course the end result is the same...
> 
Yeah, I thought about that because it could be confusing.

Will change that and sent the new patches.

Cheers,

Paul.



More information about the wine-devel mailing list