Author: pschweitzer
Date: Sun Mar 20 10:51:14 2016
New Revision: 71027
URL:
http://svn.reactos.org/svn/reactos?rev=71027&view=rev
Log:
[NTDLL_APITEST]
Set correct locale in RtlGenerate8dot3Name test.
This makes the test reproducible on every target plateform.
Patch by Mark Jansen.
ROSTESTS-218 #resolve #comment Patch commited in r71027. Thanks!
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/RtlGenerat…
==============================================================================
--- trunk/rostests/apitests/ntdll/RtlGenerate8dot3Name.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/ntdll/RtlGenerate8dot3Name.c [iso-8859-1] Sun Mar 20 10:51:14
2016
@@ -9,6 +9,7 @@
#define WIN32_NO_STATUS
#include <ndk/rtlfuncs.h>
+#include <stdio.h>
NTSYSAPI
VOID
@@ -24,10 +25,56 @@
PWSTR ShortNames2[] = { L"MENUDM~2", L"SLECTE~2.LNK",
L"5C2D~2.TXT", L"423C~2.TXT", L"925E~2.TXT",
L"7E4C~2.TXT", L"EEAUC~2.TXT", L"ECU~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" };
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)
{