From a000763117fe84ad7a56caba64b0938c55bac877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Wed, 11 Jan 2017 20:02:14 +0000 Subject: [PATCH] [SHELL32]: Partly restore code (AddCommasW function) that was implemented in r33953 but removed in the next revision r33954. svn path=/trunk/; revision=73524 --- reactos/dll/win32/shell32/shell32.cpp | 39 +++++++++++++++++++++++++++ reactos/dll/win32/shell32/stubs.cpp | 13 --------- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/reactos/dll/win32/shell32/shell32.cpp b/reactos/dll/win32/shell32/shell32.cpp index 2ef621af55f..4eb18473dd9 100644 --- a/reactos/dll/win32/shell32/shell32.cpp +++ b/reactos/dll/win32/shell32/shell32.cpp @@ -25,6 +25,45 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); +/* + * Implemented + */ +EXTERN_C LPWSTR +WINAPI +AddCommasW(DWORD lValue, LPWSTR lpNumber) +{ + WCHAR szValue[MAX_PATH], szSeparator[8 + 1]; + NUMBERFMTW numFormat; + + GetLocaleInfoW(LOCALE_USER_DEFAULT, + LOCALE_STHOUSAND, + szSeparator, + ARRAYSIZE(szSeparator)); + + numFormat.NumDigits = 0; + numFormat.LeadingZero = 0; + numFormat.Grouping = 0; // FIXME! Use GetLocaleInfoW with LOCALE_SGROUPING and interpret the result. + numFormat.lpDecimalSep = szSeparator; + numFormat.lpThousandSep = szSeparator; + numFormat.NegativeOrder = 0; + + swprintf(szValue, L"%llu", lValue); + //_ultow(lValue, szValue, 10); + + if (GetNumberFormatW(LOCALE_USER_DEFAULT, + 0, + szValue, + &numFormat, + lpNumber, + wcslen(lpNumber)) != 0) + { + return lpNumber; + } + + wcscpy(lpNumber, szValue); + return lpNumber; +} + /************************************************************************** * Default ClassFactory types */ diff --git a/reactos/dll/win32/shell32/stubs.cpp b/reactos/dll/win32/shell32/stubs.cpp index df6f7fa1373..0a2e12a4d4e 100644 --- a/reactos/dll/win32/shell32/stubs.cpp +++ b/reactos/dll/win32/shell32/stubs.cpp @@ -14,19 +14,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); -/* - * Unimplemented - */ -EXTERN_C LPWSTR -WINAPI -AddCommasW(DWORD dwUnknown, LPWSTR lpNumber) -{ - LPCWSTR lpRetBuf = L"0"; - - FIXME("AddCommasW() stub\n"); - return const_cast(lpRetBuf); -} - /* * Unimplemented */