[PATCH] comctl32/tests: Use GetLocaleInfoA when the buffer size is in bytes (Coverity)

Alex Henrie alexhenrie24 at gmail.com
Mon Dec 27 00:34:11 CST 2021


On Sun, Dec 26, 2021 at 10:51 PM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>
> I thought for RETURN_NUMBER, A vs W work the same. Is that not the case?

MSDN says [1]:

> [in] cchData
>
> Size, in TCHAR values, of the data buffer indicated by lpLCData.
>
> Return value
>
> Returns the number of characters retrieved in the locale data buffer if successful and cchData is a nonzero value. If the function succeeds, cchData is nonzero, and LOCALE_RETURN_NUMBER is specified, the return value is the size of the integer retrieved in the data buffer; that is, 2 for the Unicode version of the function or 4 for the ANSI version.

And a quick test shows that the call to GetLocaleInfoW succeeds with
cchData=2 on both Windows and Wine, but GetLocaleInfoA with cchData=2
fails on both Windows and Wine.

-Alex

[1] https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getlocaleinfoa



More information about the wine-devel mailing list