ntdll/tests: Add some tests for registry path names.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-02-08 22:56:38 +09:00
parent f7915d4e43
commit 883ca7395b
1 changed files with 144 additions and 6 deletions

View File

@ -367,21 +367,73 @@ static void test_NtOpenKey(void)
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);
pRtlFreeUnicodeString( &str );
/* 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);
pNtClose(key);
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "" );
status = pNtOpenKey(&key, KEY_READ, &attr);
todo_wine
ok( status == STATUS_OBJECT_PATH_SYNTAX_BAD, "NtOpenKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\" );
status = pNtOpenKey(&key, KEY_READ, &attr);
todo_wine
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "NtOpenKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Registry" );
status = pNtOpenKey(&key, KEY_READ, &attr);
todo_wine
ok( status == STATUS_SUCCESS, "NtOpenKey failed: 0x%08x\n", status );
pNtClose( key );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Registry\\" );
status = pNtOpenKey(&key, KEY_READ, &attr);
ok( status == STATUS_SUCCESS, "NtOpenKey failed: 0x%08x\n", status );
pNtClose( key );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Foobar" );
status = pNtOpenKey(&key, KEY_READ, &attr);
todo_wine
ok( status == STATUS_OBJECT_NAME_NOT_FOUND, "NtOpenKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Foobar\\Machine" );
status = pNtOpenKey(&key, KEY_READ, &attr);
todo_wine
ok( status == STATUS_OBJECT_PATH_NOT_FOUND, "NtOpenKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Machine\\Software\\Classes" );
status = pNtOpenKey(&key, KEY_READ, &attr);
todo_wine
ok( status == STATUS_OBJECT_PATH_NOT_FOUND, "NtOpenKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "Machine\\Software\\Classes" );
status = pNtOpenKey(&key, KEY_READ, &attr);
todo_wine
ok( status == STATUS_OBJECT_PATH_SYNTAX_BAD, "NtOpenKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Device\\Null" );
status = pNtOpenKey(&key, KEY_READ, &attr);
todo_wine
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "NtOpenKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
if (!pNtOpenKeyEx)
{
@ -477,6 +529,92 @@ static void test_NtCreateKey(void)
pNtDeleteKey( subkey );
pNtClose( subkey );
attr.RootDirectory = 0;
attr.Attributes = OBJ_CASE_INSENSITIVE;
pRtlCreateUnicodeStringFromAsciiz( &str, "" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
todo_wine
ok( status == STATUS_OBJECT_PATH_SYNTAX_BAD, "NtCreateKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
todo_wine
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "NtCreateKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Registry" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
todo_wine
ok( status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED,
"NtCreateKey failed: 0x%08x\n", status );
if (!status) pNtClose( subkey );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Registry\\" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
ok( status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED,
"NtCreateKey failed: 0x%08x\n", status );
if (!status) pNtClose( subkey );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Foobar" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
todo_wine
ok( status == STATUS_OBJECT_NAME_NOT_FOUND, "NtCreateKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Foobar\\Machine" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
todo_wine
ok( status == STATUS_OBJECT_PATH_NOT_FOUND, "NtCreateKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Machine\\Software\\Classes" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
todo_wine
ok( status == STATUS_OBJECT_PATH_NOT_FOUND, "NtCreateKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "Machine\\Software\\Classes" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
todo_wine
ok( status == STATUS_OBJECT_PATH_SYNTAX_BAD, "NtCreateKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Device\\Null" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
todo_wine
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "NtCreateKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Registry\\Machine\\Software\\Classes" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
ok( status == STATUS_SUCCESS, "NtCreateKey failed: 0x%08x\n", status );
pNtClose( subkey );
pRtlFreeUnicodeString( &str );
/* the REGISTRY part is case-sensitive unless OBJ_CASE_INSENSITIVE is specified */
attr.Attributes = 0;
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Registry\\Machine\\Software\\Classes" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
todo_wine
ok( status == STATUS_OBJECT_PATH_NOT_FOUND, "NtCreateKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\REGISTRY\\Machine\\Software\\Classes" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
ok( status == STATUS_SUCCESS, "NtCreateKey failed: 0x%08x\n", status );
pNtClose( subkey );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\REGISTRY\\MACHINE\\SOFTWARE\\CLASSES" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
ok( status == STATUS_SUCCESS, "NtCreateKey failed: 0x%08x\n", status );
pNtClose( subkey );
pRtlFreeUnicodeString( &str );
pNtClose(key);
}