Author: tfaber
Date: Tue May 9 07:45:30 2017
New Revision: 74510
URL:
http://svn.reactos.org/svn/reactos?rev=74510&view=rev
Log:
[SHELL32]
- Fix AddCommasW
Added:
trunk/rostests/apitests/shell32/AddCommas.c (with props)
Modified:
trunk/reactos/dll/win32/shell32/shell32.cpp
trunk/rostests/apitests/shell32/CMakeLists.txt
trunk/rostests/apitests/shell32/testlist.c
Modified: trunk/reactos/dll/win32/shell32/shell32.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32.…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] Tue May 9 07:45:30 2017
@@ -42,20 +42,19 @@
numFormat.NumDigits = 0;
numFormat.LeadingZero = 0;
- numFormat.Grouping = 0; // FIXME! Use GetLocaleInfoW with LOCALE_SGROUPING and
interpret the result.
+ numFormat.Grouping = 3; // 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);
+ swprintf(szValue, L"%lu", lValue);
if (GetNumberFormatW(LOCALE_USER_DEFAULT,
0,
szValue,
&numFormat,
lpNumber,
- wcslen(lpNumber)) != 0)
+ MAX_PATH) != 0)
{
return lpNumber;
}
Added: trunk/rostests/apitests/shell32/AddCommas.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/AddComma…
==============================================================================
--- trunk/rostests/apitests/shell32/AddCommas.c (added)
+++ trunk/rostests/apitests/shell32/AddCommas.c [iso-8859-1] Tue May 9 07:45:30 2017
@@ -0,0 +1,76 @@
+/*
+ * PROJECT: ReactOS API tests
+ * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
+ * PURPOSE: Test for AddCommas
+ * PROGRAMMER: Thomas Faber <thomas.faber(a)reactos.org>
+ */
+
+#include <apitest.h>
+#include <windef.h>
+#include <winnls.h>
+#include <bcrypt.h>
+#include <ntstatus.h>
+#include <strsafe.h>
+
+DECLSPEC_IMPORT LPWSTR WINAPI AddCommasW(DWORD lValue, LPWSTR lpNumber);
+
+START_TEST(AddCommas)
+{
+ WCHAR Separator[4];
+ WCHAR Grouping[11];
+ WCHAR Number[32];
+ WCHAR Expected[32];
+ PWSTR Ptr;
+ int Ret;
+
+ StartSeh()
+ AddCommasW(0, NULL);
+ EndSeh(STATUS_ACCESS_VIOLATION);
+
+ RtlFillMemory(Number, sizeof(Number), 0x55);
+ Ptr = AddCommasW(0, Number);
+ ok(Ptr == Number, "Ptr = %p, expected %p\n", Ptr, Number);
+ ok(Number[0] == L'0', "Number[0] = 0x%x\n", Number[0]);
+ ok(Number[1] == 0, "Number[1] = 0x%x\n", Number[1]);
+ ok(Number[2] == 0x5555, "Number[2] = 0x%x\n", Number[2]);
+
+ Ret = GetLocaleInfoW(LOCALE_USER_DEFAULT,
+ LOCALE_STHOUSAND,
+ Separator,
+ RTL_NUMBER_OF(Separator));
+ if (!Ret)
+ {
+ skip("GetLocaleInfoW failed with %lu\n", GetLastError());
+ return;
+ }
+ Ret = GetLocaleInfoW(LOCALE_USER_DEFAULT,
+ LOCALE_SGROUPING,
+ Grouping,
+ RTL_NUMBER_OF(Grouping));
+ if (!Ret)
+ {
+ skip("GetLocaleInfoW failed with %lu\n", GetLastError());
+ return;
+ }
+
+ if (wcscmp(Grouping, L"3;0"))
+ {
+ skip("Skipping remaining tests due to incompatible locale (separator
'%ls', grouping '%ls')\n",
+ Separator, Grouping);
+ return;
+ }
+
+ RtlFillMemory(Number, sizeof(Number), 0x55);
+ Ptr = AddCommasW(123456789, Number);
+ ok(Ptr == Number, "Ptr = %p, expected %p\n", Ptr, Number);
+ StringCbPrintfW(Expected, sizeof(Expected), L"123%ls456%ls789", Separator,
Separator);
+ ok(!wcscmp(Number, Expected), "Number = '%ls', expected %ls\n",
Number, Expected);
+ ok(Number[wcslen(Number) + 1] == 0x5555, "Number[N] = 0x%x\n",
Number[wcslen(Number) + 1]);
+
+ RtlFillMemory(Number, sizeof(Number), 0x55);
+ Ptr = AddCommasW(4294967295U, Number);
+ ok(Ptr == Number, "Ptr = %p, expected %p\n", Ptr, Number);
+ StringCbPrintfW(Expected, sizeof(Expected), L"4%ls294%ls967%ls295",
Separator, Separator, Separator);
+ ok(!wcscmp(Number, Expected), "Number = '%ls', expected %ls\n",
Number, Expected);
+ ok(Number[wcslen(Number) + 1] == 0x5555, "Number[N] = 0x%x\n",
Number[wcslen(Number) + 1]);
+}
Propchange: trunk/rostests/apitests/shell32/AddCommas.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/apitests/shell32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/CMakeLis…
==============================================================================
--- trunk/rostests/apitests/shell32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/shell32/CMakeLists.txt [iso-8859-1] Tue May 9 07:45:30 2017
@@ -4,6 +4,7 @@
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
add_executable(shell32_apitest
+ AddCommas.c
CFSFolder.cpp
CMyComputer.cpp
CShellDesktop.cpp
Modified: trunk/rostests/apitests/shell32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/testlist…
==============================================================================
--- trunk/rostests/apitests/shell32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/shell32/testlist.c [iso-8859-1] Tue May 9 07:45:30 2017
@@ -3,6 +3,7 @@
#define STANDALONE
#include <wine/test.h>
+extern void func_AddCommas(void);
extern void func_CFSFolder(void);
extern void func_CMyComputer(void);
extern void func_CShellDesktop(void);
@@ -13,6 +14,7 @@
const struct test winetest_testlist[] =
{
+ { "AddCommas", func_AddCommas },
{ "CFSFolder", func_CFSFolder },
{ "CMyComputer", func_CMyComputer },
{ "CShellDesktop", func_CShellDesktop },