Alexandre Julliard : ntdll/tests: Add tests for high Unicode planes.
Alexandre Julliard
julliard at winehq.org
Mon Jun 6 16:10:30 CDT 2022
Module: wine
Branch: master
Commit: 8d0b3b08986bdee53061e168e36c186fdf9ee11f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8d0b3b08986bdee53061e168e36c186fdf9ee11f
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Jun 6 14:44:20 2022 +0200
ntdll/tests: Add tests for high Unicode planes.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/tests/reg.c | 23 ++++++++++++++++++++++-
dlls/ntdll/tests/rtlstr.c | 21 ++++++++++++++++++++-
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c
index d7380ebb1be..2c158be17b4 100644
--- a/dlls/ntdll/tests/reg.c
+++ b/dlls/ntdll/tests/reg.c
@@ -342,7 +342,7 @@ static void test_RtlQueryRegistryValues(void)
static void test_NtOpenKey(void)
{
- HANDLE key;
+ HANDLE key, subkey;
NTSTATUS status;
OBJECT_ATTRIBUTES attr;
ACCESS_MASK am = KEY_READ;
@@ -456,6 +456,27 @@ static void test_NtOpenKey(void)
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "NtOpenKey failed: 0x%08lx\n", status );
pRtlFreeUnicodeString( &str );
+ InitializeObjectAttributes(&attr, &winetestpath, 0, 0, 0);
+ status = pNtOpenKey(&key, KEY_WRITE|KEY_READ, &attr);
+ ok(status == STATUS_SUCCESS, "NtOpenKey failed: 0x%08lx\n", status);
+
+ /* keys are case insensitive even without OBJ_CASE_INSENSITIVE */
+ InitializeObjectAttributes( &attr, &str, 0, key, 0 );
+ pRtlInitUnicodeString( &str, L"\xf6\xf3\x14d\x371\xd801\xdc00" );
+ status = pNtCreateKey( &subkey, KEY_ALL_ACCESS, &attr, 0, 0, 0, 0);
+ ok(status == STATUS_SUCCESS, "NtCreateKey failed: 0x%08lx\n", status);
+ pNtClose( subkey );
+ pRtlInitUnicodeString( &str, L"\xd6\xd3\x14c\x370\xd801\xdc28" ); /* surrogates not supported */
+ status = pNtOpenKeyEx(&subkey, KEY_ALL_ACCESS, &attr, 0);
+ ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "NtOpenKeyEx failed: 0x%08lx\n", status);
+ pRtlInitUnicodeString( &str, L"\xd6\xd3\x14c\x370\xd801\xdc00" );
+ status = pNtOpenKeyEx(&subkey, KEY_ALL_ACCESS, &attr, 0);
+ ok(status == STATUS_SUCCESS, "NtOpenKeyEx failed: 0x%08lx\n", status);
+
+ pNtDeleteKey( subkey );
+ pNtClose( subkey );
+ pNtClose( key );
+
if (!pNtOpenKeyEx)
{
win_skip("NtOpenKeyEx not available\n");
diff --git a/dlls/ntdll/tests/rtlstr.c b/dlls/ntdll/tests/rtlstr.c
index 1bce812ff13..49f6ef65785 100644
--- a/dlls/ntdll/tests/rtlstr.c
+++ b/dlls/ntdll/tests/rtlstr.c
@@ -608,7 +608,7 @@ static void test_RtlUpcaseUnicodeChar(void)
static void test_RtlUpcaseUnicodeString(void)
{
- int i;
+ int i, j;
WCHAR ch;
WCHAR upper_ch;
WCHAR ascii_buf[257];
@@ -654,6 +654,25 @@ static void test_RtlUpcaseUnicodeString(void)
result_str.Buffer[i], result_str.Buffer[i],
upper_str.Buffer[i], upper_str.Buffer[i]);
}
+
+ /* test surrogates */
+ for (i = 0x100; i < 0x1100; i++)
+ {
+ WCHAR src[512], dst[512];
+ for (j = 0; j < 256; j++)
+ {
+ unsigned int ch = ((i << 8) + j) - 0x10000;
+ src[2 * j] = 0xd800 | (ch >> 10);
+ src[2 * j + 1] = 0xdc00 | (ch & 0x3ff);
+ }
+ upper_str.Length = upper_str.MaximumLength = 512 * sizeof(WCHAR);
+ upper_str.Buffer = src;
+ result_str.Length = result_str.MaximumLength = 512 * sizeof(WCHAR);
+ result_str.Buffer = dst;
+ pRtlUpcaseUnicodeString(&result_str, &upper_str, 0);
+ ok( !memcmp(src, dst, sizeof(dst)),
+ "string compare mismatch in %04x-%04x\n", i << 8, (i << 8) + 255 );
+ }
}
More information about the wine-cvs
mailing list