From 26df0863ca6d57c2d5ce24b79a5cd9f5e711ae83 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 19 Nov 2015 12:48:22 +0100 Subject: [PATCH] ntdll: Added more NtOpenKey tests. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/ntdll/tests/reg.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c index 0e00f998ff7..e688fd2e68f 100644 --- a/dlls/ntdll/tests/reg.c +++ b/dlls/ntdll/tests/reg.c @@ -340,6 +340,7 @@ static void test_NtOpenKey(void) NTSTATUS status; OBJECT_ATTRIBUTES attr; ACCESS_MASK am = KEY_READ; + UNICODE_STRING str; /* All NULL */ status = pNtOpenKey(NULL, 0, NULL); @@ -361,6 +362,27 @@ static void test_NtOpenKey(void) status = pNtOpenKey(&key, am, &attr); ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got: 0x%08x\n", status); + /* Calling without parent key requres full registry path. */ + pRtlCreateUnicodeStringFromAsciiz( &str, "Machine" ); + InitializeObjectAttributes(&attr, &str, 0, 0, 0); + status = pNtOpenKey(&key, KEY_READ, &attr); + todo_wine ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD, "NtOpenKey Failed: 0x%08x\n", status); + if (!status) + pNtClose(key); + + /* Open is case sensitive unless OBJ_CASE_INSENSITIVE is specified. */ + pRtlCreateUnicodeStringFromAsciiz( &str, "\\Registry\\Machine" ); + status = pNtOpenKey(&key, KEY_READ, &attr); + todo_wine ok(status == STATUS_OBJECT_PATH_NOT_FOUND, "NtOpenKey Failed: 0x%08x\n", status); + if (!status) + pNtClose(key); + + attr.Attributes = OBJ_CASE_INSENSITIVE; + status = pNtOpenKey(&key, KEY_READ, &attr); + ok(status == STATUS_SUCCESS, "NtOpenKey Failed: 0x%08x\n", status); + if (!status) + pNtClose(key); + if (!pNtOpenKeyEx) { win_skip("NtOpenKeyEx not available\n");