Index: apitests/ntdll/RtlGenerate8dot3Name.c =================================================================== --- apitests/ntdll/RtlGenerate8dot3Name.c (revision 70278) +++ apitests/ntdll/RtlGenerate8dot3Name.c (working copy) @@ -9,6 +9,7 @@ #define WIN32_NO_STATUS #include +#include NTSYSAPI VOID @@ -25,10 +26,59 @@ PWSTR ExShortNames1[] = { L"MENUDÉ~1", L"SÉLECT~1.LNK", L"ÉÈÀÙÇ~1.TXT", L"ÇÙÀÈÉ~1.TXT", L"ÉÈÀÙ~1.TXT", L"ÇÙÀÈ~1.TXT", L"ÉÈÀÙÇE~1.TXT", L"ÉEÈÉÇC~1.TXT", L"TEST~1.ÉXÈ", L"T£$T¤~1.TXT", L"LONGFI~1.TXT", L"LONGFI~1", L"LONGFI~1.TXT", L"LONGFI~1" }; PWSTR ExShortNames2[] = { L"MENUDÉ~2", L"SÉLECT~2.LNK", L"ÉÈÀÙÇ~2.TXT", L"ÇÙÀÈÉ~2.TXT", L"ÉÈÀÙ~2.TXT", L"ÇÙÀÈ~2.TXT", L"ÉÈÀÙÇE~2.TXT", L"ÉEÈÉÇC~2.TXT", L"TEST~2.ÉXÈ", L"T£$T¤~2.TXT", L"LONGFI~2.TXT", L"LONGFI~2", L"LONGFI~2.TXT", L"LONGFI~2" }; + +PVOID LoadCodePageData(ULONG Code) +{ + char filename[MAX_PATH], sysdir[MAX_PATH]; + HANDLE hFile; + PVOID Data = NULL; + GetSystemDirectoryA(sysdir, MAX_PATH); + + if (Code != -1) + sprintf(filename, "%s\\c_%lu.nls", sysdir, Code); + else + sprintf(filename, "%s\\l_intl.nls", sysdir); + + hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + if (hFile != INVALID_HANDLE_VALUE) + { + DWORD dwRead; + DWORD dwFileSize = GetFileSize(hFile, NULL); + Data = malloc(dwFileSize); + ReadFile(hFile, Data, dwFileSize, &dwRead, NULL); + CloseHandle(hFile); + } + return Data; +} + +//https://www.microsoft.com/resources/msdn/goglobal/default.mspx + +void SetupLocale(ULONG AnsiCode, ULONG OemCode, ULONG Unicode) +{ + NLSTABLEINFO NlsTable; + PVOID AnsiCodePageData; + PVOID OemCodePageData; + PVOID UnicodeCaseTableData; + + AnsiCodePageData = LoadCodePageData(AnsiCode); + OemCodePageData = LoadCodePageData(OemCode); + UnicodeCaseTableData = LoadCodePageData(Unicode); + + RtlInitNlsTables(AnsiCodePageData, OemCodePageData, UnicodeCaseTableData, &NlsTable); + RtlResetRtlTranslations(&NlsTable); + /* Do NOT free the buffers here, they are directly used! + Yes, we leak the old buffers, but this is a test anyway... */ + +} + + START_TEST(RtlGenerate8dot3Name) { USHORT i; + /* Set a french locale. */ + SetupLocale(1252, 850, -1); + for (i = 0; i < 14; ++i) { WCHAR Buffer[12];