Author: tfaber
Date: Fri Feb 27 22:42:35 2015
New Revision: 66479
URL:
http://svn.reactos.org/svn/reactos?rev=66479&view=rev
Log:
[KMTESTS]
- Add a test showing RtlUpcaseUnicodeString behavior with zero-length strings
- Run all test cases against FsRtlIsNameInExpressionTest on checked builds, only the Dbcs
version asserts
CORE-9254
Modified:
trunk/rostests/kmtests/include/kmt_platform.h
trunk/rostests/kmtests/kmtest_drv/testlist.c
trunk/rostests/kmtests/ntos_fsrtl/FsRtlExpression.c
trunk/rostests/kmtests/rtl/RtlUnicodeString.c
Modified: trunk/rostests/kmtests/include/kmt_platform.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/include/kmt_platf…
==============================================================================
--- trunk/rostests/kmtests/include/kmt_platform.h [iso-8859-1] (original)
+++ trunk/rostests/kmtests/include/kmt_platform.h [iso-8859-1] Fri Feb 27 22:42:35 2015
@@ -56,6 +56,7 @@
#define RtlCopyMemoryNonTemporal RtlCopyMemory
#define RtlPrefetchMemoryNonTemporal(s, l)
#define ExRaiseStatus RtlRaiseStatus
+#define KmtIsCheckedBuild FALSE
#endif /* defined KMT_EMULATE_KERNEL */
#endif /* defined KMT_USER_MODE */
Modified: trunk/rostests/kmtests/kmtest_drv/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/testli…
==============================================================================
--- trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] Fri Feb 27 22:42:35 2015
@@ -59,6 +59,7 @@
KMT_TESTFUNC Test_RtlMemory;
KMT_TESTFUNC Test_RtlRegistry;
KMT_TESTFUNC Test_RtlSplayTree;
+KMT_TESTFUNC Test_RtlUnicodeString;
KMT_TESTFUNC Test_ZwAllocateVirtualMemory;
KMT_TESTFUNC Test_ZwCreateSection;
KMT_TESTFUNC Test_ZwMapViewOfSection;
@@ -117,6 +118,7 @@
{ "RtlMemoryKM", Test_RtlMemory },
{ "RtlRegistryKM", Test_RtlRegistry },
{ "RtlSplayTreeKM", Test_RtlSplayTree },
+ { "RtlUnicodeStringKM", Test_RtlUnicodeString },
{ "ZwAllocateVirtualMemory", Test_ZwAllocateVirtualMemory },
{ "ZwCreateSection", Test_ZwCreateSection },
{ "ZwMapViewOfSection", Test_ZwMapViewOfSection },
Modified: trunk/rostests/kmtests/ntos_fsrtl/FsRtlExpression.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_fsrtl/FsRtlE…
==============================================================================
--- trunk/rostests/kmtests/ntos_fsrtl/FsRtlExpression.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_fsrtl/FsRtlExpression.c [iso-8859-1] Fri Feb 27 22:42:35
2015
@@ -184,10 +184,6 @@
UNICODE_STRING Expression;
UNICODE_STRING Name;
- /* Don't run Tests which are known to assert in checked builds */
- if (KmtIsCheckedBuild && Tests[i].AssertsInChecked)
- continue;
-
RtlInitUnicodeString(&Expression, Tests[i].Expression);
RtlInitUnicodeString(&Name, Tests[i].Name);
Modified: trunk/rostests/kmtests/rtl/RtlUnicodeString.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/rtl/RtlUnicodeStr…
==============================================================================
--- trunk/rostests/kmtests/rtl/RtlUnicodeString.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/rtl/RtlUnicodeString.c [iso-8859-1] Fri Feb 27 22:42:35 2015
@@ -87,7 +87,7 @@
Status = RtlFindCharInUnicodeString(7, &String, &Chars4, &Position);
ok_eq_hex(Status, STATUS_SUCCESS);
ok_eq_uint(Position, 22);
-
+
/* Show that Position is USHORT */
LongPosition = 0x55555555;
Status = RtlFindCharInUnicodeString(8, &String, &String,
(PUSHORT)&LongPosition);
@@ -116,7 +116,7 @@
Status = RtlFindCharInUnicodeString(0, NULL, &String, &Position);
KmtEndSeh(STATUS_ACCESS_VIOLATION);
ok_eq_uint(Position, 0);
-
+
/* NULL for SearchString and invalid flags */
Position = 123;
KmtStartSeh()
@@ -150,7 +150,7 @@
KmtEndSeh(STATUS_ACCESS_VIOLATION);
ok_eq_uint(Position, 0);
#endif
-
+
/* NULL for MatchString and invalid flags */
Position = 123;
KmtStartSeh()
@@ -171,9 +171,89 @@
KmtEndSeh(STATUS_SUCCESS);
ok_eq_hex(Status, STATUS_INVALID_PARAMETER);
#endif
+}
+
+static
+VOID
+TestUpcaseUnicodeString(VOID)
+{
+ NTSTATUS Status;
+ UNICODE_STRING Lower;
+ UNICODE_STRING Upper;
+ PWCHAR Buffer;
+
+ Buffer = KmtAllocateGuarded(sizeof(WCHAR));
+
+ if (!KmtIsCheckedBuild)
+ {
+ RtlInitEmptyUnicodeString(&Lower, NULL, 0);
+ RtlFillMemory(&Upper, sizeof(Upper), 0x55);
+ Status = RtlUpcaseUnicodeString(&Upper, &Lower, TRUE);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ ok_eq_uint(Upper.Length, 0);
+ ok_eq_uint(Upper.MaximumLength, 0);
+ ok(Upper.Buffer != NULL, "Buffer = %p\n", Upper.Buffer);
+ RtlFreeUnicodeString(&Upper);
+
+ RtlInitEmptyUnicodeString(&Lower, Buffer, 0);
+ RtlFillMemory(&Upper, sizeof(Upper), 0x55);
+ Status = RtlUpcaseUnicodeString(&Upper, &Lower, TRUE);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ ok_eq_uint(Upper.Length, 0);
+ ok_eq_uint(Upper.MaximumLength, 0);
+ ok(Upper.Buffer != NULL, "Buffer = %p\n", Upper.Buffer);
+ RtlFreeUnicodeString(&Upper);
+
+ RtlInitEmptyUnicodeString(&Lower, Buffer, sizeof(WCHAR));
+ Buffer[0] = UNICODE_NULL;
+ RtlFillMemory(&Upper, sizeof(Upper), 0x55);
+ Status = RtlUpcaseUnicodeString(&Upper, &Lower, TRUE);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ ok_eq_uint(Upper.Length, 0);
+ ok_eq_uint(Upper.MaximumLength, 0);
+ ok(Upper.Buffer != NULL, "Buffer = %p\n", Upper.Buffer);
+ RtlFreeUnicodeString(&Upper);
+ }
+
+ RtlInitEmptyUnicodeString(&Lower, Buffer, sizeof(WCHAR));
+ Lower.Length = sizeof(WCHAR);
+ Buffer[0] = UNICODE_NULL;
+ RtlFillMemory(&Upper, sizeof(Upper), 0x55);
+ Status = RtlUpcaseUnicodeString(&Upper, &Lower, TRUE);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ ok_eq_uint(Upper.Length, sizeof(WCHAR));
+ ok_eq_uint(Upper.MaximumLength, sizeof(WCHAR));
+ ok(Upper.Buffer != NULL, "Buffer = %p\n", Upper.Buffer);
+ ok_eq_hex(Upper.Buffer[0], UNICODE_NULL);
+ RtlFreeUnicodeString(&Upper);
+
+ RtlInitEmptyUnicodeString(&Lower, Buffer, sizeof(WCHAR));
+ Lower.Length = sizeof(WCHAR);
+ Buffer[0] = 'a';
+ RtlFillMemory(&Upper, sizeof(Upper), 0x55);
+ Status = RtlUpcaseUnicodeString(&Upper, &Lower, TRUE);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ ok_eq_uint(Upper.Length, sizeof(WCHAR));
+ ok_eq_uint(Upper.MaximumLength, sizeof(WCHAR));
+ ok(Upper.Buffer != NULL, "Buffer = %p\n", Upper.Buffer);
+ ok_eq_hex(Upper.Buffer[0], 'A');
+ RtlFreeUnicodeString(&Upper);
+
+ RtlInitUnicodeString(&Lower, L"a");
+ RtlFillMemory(&Upper, sizeof(Upper), 0x55);
+ Status = RtlUpcaseUnicodeString(&Upper, &Lower, TRUE);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ ok_eq_uint(Upper.Length, sizeof(WCHAR));
+ ok_eq_uint(Upper.MaximumLength, sizeof(WCHAR));
+ ok(Upper.Buffer != NULL, "Buffer = %p\n", Upper.Buffer);
+ ok_eq_hex(Upper.Buffer[0], 'A');
+ RtlFreeUnicodeString(&Upper);
+
+ KmtFreeGuarded(Buffer);
}
START_TEST(RtlUnicodeString)
{
TestFindCharInUnicodeString();
+ TestUpcaseUnicodeString();
}