[NTDLL_APITEST]
authorThomas Faber <thomas.faber@reactos.org>
Thu, 10 Nov 2016 10:18:25 +0000 (10:18 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Thu, 10 Nov 2016 10:18:25 +0000 (10:18 +0000)
- Add tests for RtlIsNameLegalDOS8Dot3 and RtlUpcaseUnicodeStringToCountedOemString with the ® sign.
CORE-8617

svn path=/trunk/; revision=73190

rostests/apitests/ntdll/CMakeLists.txt
rostests/apitests/ntdll/RtlIsNameLegalDOS8Dot3.c [new file with mode: 0644]
rostests/apitests/ntdll/RtlUpcaseUnicodeStringToCountedOemString.c [new file with mode: 0644]
rostests/apitests/ntdll/testlist.c

index 4eab1e6..aee65bc 100644 (file)
@@ -40,8 +40,10 @@ list(APPEND SOURCE
     RtlGetLongestNtPathLength.c
     RtlImageRvaToVa.c
     RtlInitializeBitMap.c
+    RtlIsNameLegalDOS8Dot3.c
     RtlMemoryStream.c
     RtlReAllocateHeap.c
+    RtlUpcaseUnicodeStringToCountedOemString.c
     StackOverflow.c
     SystemInfo.c
     Timer.c
diff --git a/rostests/apitests/ntdll/RtlIsNameLegalDOS8Dot3.c b/rostests/apitests/ntdll/RtlIsNameLegalDOS8Dot3.c
new file mode 100644 (file)
index 0000000..40a52c3
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * PROJECT:         ReactOS API tests
+ * LICENSE:         LGPLv2.1+ - See COPYING.LIB in the top level directory
+ * PURPOSE:         Test for RtlIsNameLegalDOS8Dot3
+ * PROGRAMMER:      Thomas Faber <thomas.faber@reactos.org>
+ */
+
+#include <apitest.h>
+
+#define WIN32_NO_STATUS
+#include <ndk/rtlfuncs.h>
+
+START_TEST(RtlIsNameLegalDOS8Dot3)
+{
+    UNICODE_STRING Name;
+    CHAR OemNameBuffer[13];
+    OEM_STRING OemName;
+    BOOLEAN NameContainsSpaces;
+    BOOLEAN IsLegal;
+
+    RtlInitUnicodeString(&Name, L"\x00ae");
+    RtlFillMemory(OemNameBuffer, sizeof(OemNameBuffer), 0x55);
+    OemName.Buffer = OemNameBuffer;
+    OemName.Length = 0;
+    OemName.MaximumLength = sizeof(OemNameBuffer);
+    NameContainsSpaces = 0x55;
+    IsLegal = RtlIsNameLegalDOS8Dot3(&Name, &OemName, &NameContainsSpaces);
+    ok(IsLegal == TRUE, "IsLegal = %u\n", IsLegal);
+    ok(NameContainsSpaces == FALSE, "NameContainsSpaces = %u\n", NameContainsSpaces);
+    ok(OemName.Length == 1, "OemName.Length = %u\n", OemName.Length);
+    ok(OemNameBuffer[0] == 'R', "OemNameBuffer[0] = 0x%x\n", OemNameBuffer[0]);
+    ok(OemNameBuffer[1] == 0x55, "OemNameBuffer[1] = 0x%x\n", OemNameBuffer[1]);
+    ok(OemNameBuffer[2] == 0x55, "OemNameBuffer[2] = 0x%x\n", OemNameBuffer[2]);
+
+}
diff --git a/rostests/apitests/ntdll/RtlUpcaseUnicodeStringToCountedOemString.c b/rostests/apitests/ntdll/RtlUpcaseUnicodeStringToCountedOemString.c
new file mode 100644 (file)
index 0000000..0febe21
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * PROJECT:         ReactOS API tests
+ * LICENSE:         LGPLv2.1+ - See COPYING.LIB in the top level directory
+ * PURPOSE:         Test for RtlUpcaseUnicodeStringToCountedOemString
+ * PROGRAMMER:      Thomas Faber <thomas.faber@reactos.org>
+ */
+
+#include <apitest.h>
+
+#define WIN32_NO_STATUS
+#include <ndk/rtlfuncs.h>
+
+START_TEST(RtlUpcaseUnicodeStringToCountedOemString)
+{
+    NTSTATUS Status;
+    UNICODE_STRING Name;
+    CHAR OemNameBuffer[13];
+    OEM_STRING OemName;
+
+    RtlInitUnicodeString(&Name, L"\x00ae");
+    RtlFillMemory(OemNameBuffer, sizeof(OemNameBuffer), 0x55);
+    OemName.Buffer = OemNameBuffer;
+    OemName.Length = 0;
+    OemName.MaximumLength = sizeof(OemNameBuffer);
+    Status = RtlUpcaseUnicodeStringToCountedOemString(&OemName, &Name, FALSE);
+    ok(Status == STATUS_SUCCESS, "Status = 0x%lx\n", Status);
+    ok(OemName.Length == 1, "OemName.Length = %u\n", OemName.Length);
+    ok(OemNameBuffer[0] == 'R', "OemNameBuffer[0] = 0x%x\n", OemNameBuffer[0]);
+    ok(OemNameBuffer[1] == 0x55, "OemNameBuffer[1] = 0x%x\n", OemNameBuffer[1]);
+    ok(OemNameBuffer[2] == 0x55, "OemNameBuffer[2] = 0x%x\n", OemNameBuffer[2]);
+}
index 9a5f955..3ddca77 100644 (file)
@@ -44,8 +44,10 @@ extern void func_RtlGetLengthWithoutTrailingPathSeperators(void);
 extern void func_RtlGetLongestNtPathLength(void);
 extern void func_RtlImageRvaToVa(void);
 extern void func_RtlInitializeBitMap(void);
+extern void func_RtlIsNameLegalDOS8Dot3(void);
 extern void func_RtlMemoryStream(void);
 extern void func_RtlReAllocateHeap(void);
+extern void func_RtlUpcaseUnicodeStringToCountedOemString(void);
 extern void func_StackOverflow(void);
 extern void func_TimerResolution(void);
 
@@ -92,8 +94,10 @@ const struct test winetest_testlist[] =
     { "RtlGetLongestNtPathLength",      func_RtlGetLongestNtPathLength },
     { "RtlImageRvaToVa",                func_RtlImageRvaToVa },
     { "RtlInitializeBitMap",            func_RtlInitializeBitMap },
+    { "RtlIsNameLegalDOS8Dot3",         func_RtlIsNameLegalDOS8Dot3 },
     { "RtlMemoryStream",                func_RtlMemoryStream },
     { "RtlReAllocateHeap",              func_RtlReAllocateHeap },
+    { "RtlUpcaseUnicodeStringToCountedOemString", func_RtlUpcaseUnicodeStringToCountedOemString },
     { "StackOverflow",                  func_StackOverflow },
     { "TimerResolution",                func_TimerResolution },