https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ef2e1871b18be3a489b16…
commit ef2e1871b18be3a489b1649207f423471332c024
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Fri Jan 3 17:41:14 2020 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Fri Jan 3 17:41:14 2020 +0100
[NTDLL_APITEST] Addendum to ae8c9a1f: really test the "zero Length, non-zero
MaximumLength" case. + add few simplifications.
---
modules/rostests/apitests/ntdll/RtlValidateUnicodeString.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/rostests/apitests/ntdll/RtlValidateUnicodeString.c
b/modules/rostests/apitests/ntdll/RtlValidateUnicodeString.c
index 8c900613d0e..c66c94dc14e 100644
--- a/modules/rostests/apitests/ntdll/RtlValidateUnicodeString.c
+++ b/modules/rostests/apitests/ntdll/RtlValidateUnicodeString.c
@@ -34,7 +34,7 @@ START_TEST(RtlValidateUnicodeString)
ok(Status == STATUS_INVALID_PARAMETER, "Status = 0x%lx\n", Status);
// With a non-NULL but empty buffer, and zero lengths.
- String.Buffer = L"";
+ RtlInitEmptyUnicodeString(&String, L"", 0);
Status = RtlValidateUnicodeString(0, &String);
ok(Status == STATUS_SUCCESS, "Status = 0x%lx\n", Status);
Status = RtlValidateUnicodeString(1, &String);
@@ -43,7 +43,7 @@ START_TEST(RtlValidateUnicodeString)
ok(Status == STATUS_INVALID_PARAMETER, "Status = 0x%lx\n", Status);
// With a non-NULL but empty buffer, and zero Length, non-zero MaximumLength.
- String.Buffer = L"";
+ RtlInitEmptyUnicodeString(&String, L"", sizeof(WCHAR));
String.Length = 0;
Status = RtlValidateUnicodeString(0, &String);
ok(Status == STATUS_SUCCESS, "Status = 0x%lx\n", Status);
@@ -78,7 +78,8 @@ START_TEST(RtlValidateUnicodeString)
Status = RtlValidateUnicodeString(0, &String);
ok(Status == STATUS_INVALID_PARAMETER, "Status = 0x%lx\n", Status);
- // NULL buffer, non-zero Length, zero MaximumLength.
+ // NULL buffer, non-zero Length, zero MaximumLength
+ // (tests also the case Length > MaximumLength that must fail).
String = ValidString;
String.Buffer = NULL;
String.MaximumLength = 0;
@@ -98,7 +99,6 @@ START_TEST(RtlValidateUnicodeString)
Status = RtlValidateUnicodeString(0, &String);
ok(Status == STATUS_INVALID_PARAMETER, "Status = 0x%lx\n", Status);
- String = ValidString;
String.MaximumLength--; // MaximumLength was already >= 2 so it remains > 0.
Status = RtlValidateUnicodeString(0, &String);
ok(Status == STATUS_INVALID_PARAMETER, "Status = 0x%lx\n", Status);