Author: pschweitzer Date: Tue Sep 13 09:57:52 2016 New Revision: 72666
URL: http://svn.reactos.org/svn/reactos?rev=72666&view=rev Log: [NTDLL_APITEST] RtlGenerate8dot3Name: show that we don't deal correctly with checksums while generating short names.
Dedicated to Christoph
Modified: trunk/rostests/apitests/ntdll/RtlGenerate8dot3Name.c
Modified: trunk/rostests/apitests/ntdll/RtlGenerate8dot3Name.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlGenerate... ============================================================================== --- trunk/rostests/apitests/ntdll/RtlGenerate8dot3Name.c [iso-8859-1] (original) +++ trunk/rostests/apitests/ntdll/RtlGenerate8dot3Name.c [iso-8859-1] Tue Sep 13 09:57:52 2016 @@ -54,6 +54,19 @@ {1252, 850}, // Most used for latin langs {1252, 437}, // Used for English US (not only) {1252, 775}, // Used for Estonian +}; + +#define LONG_NAMES_COUNT 12 +PWSTR LongNames[LONG_NAMES_COUNT] = +{ + L"Long File Name 1.txt", L"Long File Name 2.txt", L"Long File Name 3.txt", L"Long File Name 4.txt", L"Long File Name 5.txt", L"Long File Name 6.txt", + L"Very Long File Name 1.txt", L"Very Long File Name 2.txt", L"Very Long File Name 3.txt", L"Very Long File Name 4.txt", L"Very Long File Name 5.txt", L"Very Long File Name 6.txt", +}; + +PWSTR LongShortNames[LONG_NAMES_COUNT] = +{ + L"LONGFI~1.TXT", L"LONGFI~2.TXT", L"LONGFI~3.TXT", L"LONGFI~4.TXT", L"LO1796~1.TXT", L"LO1796~2.TXT", + L"VERYLO~1.TXT", L"VERYLO~2.TXT", L"VERYLO~3.TXT", L"VERYLO~4.TXT", L"VED051~1.TXT", L"VED051~2.TXT", };
PVOID LoadCodePageData(ULONG Code) @@ -141,4 +154,25 @@ ok(RtlEqualUnicodeString(&Expected, &ShortName, FALSE), "%u:: Generated: %.*S. Expected: %.*S\n", j, ShortName.Length / sizeof(WCHAR), ShortName.Buffer, Expected.Length / sizeof(WCHAR), Expected.Buffer); } } + + { + WCHAR Buffer[12]; + GENERATE_NAME_CONTEXT Context; + UNICODE_STRING LongName, ShortName, Expected; + + ShortName.Buffer = Buffer; + ShortName.MaximumLength = sizeof(Buffer); + + for (i = 0; i < LONG_NAMES_COUNT; ++i) + { + if (i % 6 == 0) RtlZeroMemory(&Context, sizeof(GENERATE_NAME_CONTEXT)); + + RtlInitUnicodeString(&LongName, LongNames[i]); + ShortName.Length = 0; + + RtlGenerate8dot3Name(&LongName, FALSE, &Context, &ShortName); + RtlInitUnicodeString(&Expected, LongShortNames[i]); + ok(RtlEqualUnicodeString(&Expected, &ShortName, FALSE), "%u:: Generated: %.*S. Expected: %.*S\n", i, ShortName.Length / sizeof(WCHAR), ShortName.Buffer, Expected.Length / sizeof(WCHAR), Expected.Buffer); + } + } }