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

Alexandre Julliard julliard at winehq.org
Thu Jul 26 09:03:34 CDT 2007


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...

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list