From 9caaf3d69cf8797e72516762be0b2c8e33e6eeec Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 7 Aug 2010 22:41:23 +0000 Subject: [PATCH] =?UTF-8?q?[KERNEL32]=20Convert=20default=20locales=20to?= =?UTF-8?q?=20actual=20locale=20identifiers,=20before=20passing=20to=20IsV?= =?UTF-8?q?alidLocale().=20Fixes=20corrupted=20file=20size=20strings=20in?= =?UTF-8?q?=20explorer.=20[SHLWAPI]=20Fix=20some=20comments=20(As=20usual:?= =?UTF-8?q?=20"should=20be=20sent=20to=20wine")=20Patch=20by=20Rafal=20Har?= =?UTF-8?q?abie=C5=84,=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See issue #5557 for more details. svn path=/trunk/; revision=48482 --- reactos/dll/win32/kernel32/misc/lcformat.c | 8 ++++++-- reactos/dll/win32/shlwapi/string.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/kernel32/misc/lcformat.c b/reactos/dll/win32/kernel32/misc/lcformat.c index 72f909d959e..132452bb845 100644 --- a/reactos/dll/win32/kernel32/misc/lcformat.c +++ b/reactos/dll/win32/kernel32/misc/lcformat.c @@ -1044,8 +1044,10 @@ INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags, TRACE("(0x%04x,0x%08x,%s,%p,%p,%d)\n", lcid, dwFlags, debugstr_w(lpszValue), lpFormat, lpNumberStr, cchOut); + lcid = ConvertDefaultLocale(lcid); + if (!lpszValue || cchOut < 0 || (cchOut > 0 && !lpNumberStr) || - !IsValidLocale(lcid, 0) || + !IsValidLocale(lcid, LCID_INSTALLED) || (lpFormat && (dwFlags || !lpFormat->lpDecimalSep || !lpFormat->lpThousandSep))) { goto error; @@ -1415,8 +1417,10 @@ INT WINAPI GetCurrencyFormatW(LCID lcid, DWORD dwFlags, TRACE("(0x%04x,0x%08x,%s,%p,%p,%d)\n", lcid, dwFlags, debugstr_w(lpszValue), lpFormat, lpCurrencyStr, cchOut); + lcid = ConvertDefaultLocale(lcid); + if (!lpszValue || cchOut < 0 || (cchOut > 0 && !lpCurrencyStr) || - !IsValidLocale(lcid, 0) || + !IsValidLocale(lcid, LCID_INSTALLED) || (lpFormat && (dwFlags || !lpFormat->lpDecimalSep || !lpFormat->lpThousandSep || !lpFormat->lpCurrencySymbol || lpFormat->NegativeOrder > 15 || lpFormat->PositiveOrder > 3))) diff --git a/reactos/dll/win32/shlwapi/string.c b/reactos/dll/win32/shlwapi/string.c index 6102f3c928c..1609c3812b1 100644 --- a/reactos/dll/win32/shlwapi/string.c +++ b/reactos/dll/win32/shlwapi/string.c @@ -91,7 +91,7 @@ static void FillNumberFmt(NUMBERFMTW *fmt, LPWSTR decimal_buffer, int decimal_bu * Format an integer according to the current locale * * RETURNS - * The number of bytes written on success or 0 on failure + * The number of characters written on success or 0 on failure */ static int FormatInt(LONGLONG qdwValue, LPWSTR pszBuf, int cchBuf) { @@ -124,7 +124,7 @@ static int FormatInt(LONGLONG qdwValue, LPWSTR pszBuf, int cchBuf) * after the decimal point * * RETURNS - * The number of bytes written on success or 0 on failure + * The number of characters written on success or 0 on failure */ static int FormatDouble(double value, int decimals, LPWSTR pszBuf, int cchBuf) {