From: Paul Gofman pgofman@codeweavers.com
--- dlls/advapi32/tests/security.c | 4 - dlls/kernel32/tests/sync.c | 4 +- dlls/ntdll/tests/om.c | 121 +++++++++++++------------------ dlls/ntdll/tests/reg.c | 2 - dlls/ntoskrnl.exe/tests/driver.c | 6 -- dlls/setupapi/tests/devinst.c | 2 - server/device.c | 4 +- server/handle.c | 7 +- 8 files changed, 59 insertions(+), 91 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index e215ab9e5f2..56b10cee97f 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -5542,9 +5542,7 @@ static void test_mutex_security(HANDLE token)
SetLastError(0xdeadbeef); dup = OpenMutexA(0, FALSE, "WineTestMutex"); - todo_wine ok(!dup, "OpenMutex should fail\n"); - todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %lu\n", GetLastError()); }
@@ -5599,9 +5597,7 @@ static void test_event_security(HANDLE token)
SetLastError(0xdeadbeef); dup = OpenEventA(0, FALSE, "WineTestEvent"); - todo_wine ok(!dup, "OpenEvent should fail\n"); - todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %lu\n", GetLastError()); }
diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index 49420e4519f..7a6571475c2 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -248,9 +248,7 @@ static void test_mutex(void)
SetLastError(0xdeadbeef); hOpened = OpenMutexA(0, FALSE, "WineTestMutex"); - todo_wine ok(hOpened == NULL, "OpenMutex succeeded\n"); - todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %lu\n", GetLastError());
SetLastError(0xdeadbeef); @@ -289,7 +287,7 @@ static void test_mutex(void) if ((1 << i) == ACCESS_SYSTEM_SECURITY) todo_wine ok(GetLastError() == ERROR_PRIVILEGE_NOT_HELD, "wrong error %lu, access %x\n", GetLastError(), 1 << i); else - todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %lu, , access %x\n", GetLastError(), 1 << i); + ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %lu, , access %x\n", GetLastError(), 1 << i); ReleaseMutex(hCreated); failed |=0x1 << i; } diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index cbc4ad27921..91284fc3c49 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -30,6 +30,7 @@ #include "winternl.h" #include "wingdi.h" #include "winuser.h" +#include "winreg.h" #include "ddk/wdm.h" #include "wine/test.h"
@@ -3392,6 +3393,7 @@ static void test_zero_access(void) CLIENT_ID cid; HANDLE h1, h2; DWORD err; + HKEY key;
size.QuadPart = 4096; timeout.QuadPart = -10000; @@ -3410,18 +3412,15 @@ static void test_zero_access(void) ok( status == STATUS_OBJECT_NAME_EXISTS, "got %#lx.\n", status ); CloseHandle( h2 ); status = pNtCreateEvent( &h2, 0, &attr, NotificationEvent, FALSE ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtOpenEvent( &h2, EVENT_ALL_ACCESS, &attr ); ok( !status, "got %#lx.\n", status ); CloseHandle( h2 ); status = pNtOpenEvent( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); InitializeObjectAttributes( &attr, &str, OBJ_INHERIT, 0, NULL ); status = pNtOpenEvent( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status );
status = pNtDuplicateObject( GetCurrentProcess(), h1, GetCurrentProcess(), &h2, 0, 0, 0 ); ok( !status, "got %#lx.\n", status ); @@ -3443,11 +3442,9 @@ static void test_zero_access(void) ok( status == STATUS_OBJECT_NAME_EXISTS, "got %#lx.\n", status ); CloseHandle( h2 ); status = pNtCreateMutant( &h2, 0, &attr, FALSE ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtOpenMutant( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); CloseHandle( h1 );
status = pNtCreateSemaphore( &h1, 0, &attr, 1, 2 ); @@ -3461,11 +3458,9 @@ static void test_zero_access(void) ok( status == STATUS_OBJECT_NAME_EXISTS, "got %#lx.\n", status ); CloseHandle( h2 ); status = pNtCreateSemaphore( &h2, 0, &attr, 1, 2 ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtOpenSemaphore( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); CloseHandle( h1 );
status = pNtCreateKeyedEvent( &h1, 0, &attr, 0 ); @@ -3479,11 +3474,9 @@ static void test_zero_access(void) ok( status == STATUS_OBJECT_NAME_EXISTS, "got %#lx.\n", status ); CloseHandle( h2 ); status = pNtCreateKeyedEvent( &h2, 0, &attr, 0 ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtOpenKeyedEvent( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); CloseHandle( h1 );
status = pNtCreateIoCompletion( &h1, 0, &attr, 0 ); @@ -3497,11 +3490,9 @@ static void test_zero_access(void) ok( status == STATUS_OBJECT_NAME_EXISTS, "got %#lx.\n", status ); CloseHandle( h2 ); status = pNtCreateIoCompletion( &h2, 0, &attr, 0 ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtOpenIoCompletion( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); CloseHandle( h1 );
status = pNtCreateJobObject( &h1, 0, &attr ); @@ -3516,11 +3507,9 @@ static void test_zero_access(void) "got %#lx.\n", status ); if (NT_SUCCESS(status)) CloseHandle( h2 ); status = pNtCreateJobObject( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtOpenJobObject( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); CloseHandle( h1 );
status = pNtCreateDirectoryObject( &h1, 0, &attr ); @@ -3534,11 +3523,9 @@ static void test_zero_access(void) ok( status == STATUS_OBJECT_NAME_EXISTS, "got %#lx.\n", status ); CloseHandle( h2 ); status = pNtCreateDirectoryObject( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtOpenDirectoryObject( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); CloseHandle( h1 );
status = pNtCreateTimer( &h1, 0, &attr, NotificationTimer ); @@ -3552,11 +3539,9 @@ static void test_zero_access(void) ok( status == STATUS_OBJECT_NAME_EXISTS, "got %#lx.\n", status ); CloseHandle( h2 ); status = pNtCreateTimer( &h2, 0, &attr, NotificationTimer ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtOpenTimer( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); CloseHandle( h1 );
status = pNtCreateSymbolicLinkObject( &h1, 0, &attr, &target ); @@ -3571,11 +3556,9 @@ static void test_zero_access(void) "got %#lx.\n", status ); CloseHandle( h2 ); status = pNtCreateSymbolicLinkObject( &h2, 0, &attr, &target ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtOpenSymbolicLinkObject( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); CloseHandle( h1 );
status = pNtCreateSection( &h1, 0, &attr, &size, PAGE_READWRITE, SEC_COMMIT, 0 ); @@ -3589,11 +3572,9 @@ static void test_zero_access(void) ok( status == STATUS_OBJECT_NAME_EXISTS, "got %#lx.\n", status ); CloseHandle( h2 ); status = pNtCreateSection( &h2, 0, &attr, &size, PAGE_READWRITE, SEC_COMMIT, 0 ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtOpenSection( &h2, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); CloseHandle( h1 );
status = pNtCreateDebugObject( &h1, 0, &attr, 0 ); @@ -3605,8 +3586,7 @@ static void test_zero_access(void) ok( status == STATUS_OBJECT_NAME_EXISTS, "got %#lx.\n", status ); CloseHandle( h2 ); status = pNtCreateDebugObject( &h2, 0, &attr, 0 ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); CloseHandle( h1 );
pRtlInitUnicodeString( &str, L"\Device\Null" ); @@ -3616,8 +3596,7 @@ static void test_zero_access(void) CloseHandle( h1 ); status = NtCreateFile( &h1, 0, &attr, &iosb, NULL, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, 0, NULL, 0 ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h1 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status );
pRtlInitUnicodeString( &str, L"\??\c:\windows\system32\ntdll.dll" ); status = NtCreateFile( &h1, GENERIC_READ | SYNCHRONIZE, &attr, &iosb, NULL, 0, @@ -3626,13 +3605,11 @@ static void test_zero_access(void) CloseHandle( h1 ); status = NtCreateFile( &h1, 0, &attr, &iosb, NULL, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, 0, NULL, 0 ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h1 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status );
pRtlInitUnicodeString( &str, L"\Device\MailSlot\abc" ); status = pNtCreateMailslotFile( &h1, 0, &attr, &iosb, 0, 0, 0, NULL ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h1 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtCreateMailslotFile( &h1, GENERIC_ALL, &attr, &iosb, 0, 0, 0, NULL ); ok( !status, "got %#lx.\n", status ); status = pNtCreateMailslotFile( &h2, GENERIC_READ, &attr, &iosb, 0, 0, 0, NULL ); @@ -3645,8 +3622,7 @@ static void test_zero_access(void) status = pNtCreateNamedPipeFile( &h1, 0, &attr, &iosb, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_CREATE, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h1 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtCreateNamedPipeFile( &h1, GENERIC_READ | GENERIC_WRITE, &attr, &iosb, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_CREATE, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout ); @@ -3659,22 +3635,29 @@ static void test_zero_access(void) FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, FILE_PIPE_FULL_DUPLEX, FALSE, FALSE, FALSE, 1, 256, 256, &timeout ); todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h2 ); CloseHandle( h1 );
pRtlInitUnicodeString( &str, L"\REGISTRY\Machine" ); status = pNtCreateKey( &h1, 0, &attr, 0, 0, 0, 0 ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h1 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); status = pNtCreateKey( &h1, KEY_READ, &attr, 0, 0, 0, 0 ); ok( !status, "got %#lx.\n", status ); CloseHandle( h1 ); status = pNtOpenKey( &h1, KEY_READ, &attr ); ok( !status, "got %#lx.\n", status ); CloseHandle( h1 ); + err = RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software", 0, KEY_READ | KEY_WOW64_64KEY, &key); + ok( !err, "got %#lx.\n", status ); + RegCloseKey( key ); + err = RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software", 0, KEY_READ | KEY_WOW64_32KEY, &key); + ok( !err, "got %#lx.\n", status ); + RegCloseKey( key ); status = pNtOpenKey( &h1, 0, &attr ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h1 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); + err = RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software", 0, KEY_WOW64_64KEY, &key); + ok( err == ERROR_ACCESS_DENIED, "got %#lx.\n", status ); + err = RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software", 0, KEY_WOW64_32KEY, &key); + ok( err == ERROR_ACCESS_DENIED, "got %#lx.\n", status );
pRtlInitUnicodeString( &str, L"\REGISTRY\Machine\Software\foobar-test" ); status = pNtCreateKey( &h1, KEY_ALL_ACCESS, &attr, 0, 0, 0, 0 ); @@ -3697,26 +3680,22 @@ static void test_zero_access(void) ok( !status, "got %#lx.\n", status ); CloseHandle( h1 ); status = pNtOpenProcessToken( GetCurrentProcess(), 0, &h1 ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h1 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status );
status = NtGetNextThread(GetCurrentProcess(), NULL, 0, 0, 0, &h1); - todo_wine ok( status == STATUS_NO_MORE_ENTRIES, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h1 ); + ok( status == STATUS_NO_MORE_ENTRIES, "got %#lx.\n", status );
InitializeObjectAttributes( &attr, NULL, 0, 0, NULL ); cid.UniqueProcess = ULongToHandle( GetCurrentProcessId() ); cid.UniqueThread = 0; status = pNtOpenProcess( &h1, 0, &attr, &cid ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h1 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status );
InitializeObjectAttributes( &attr, NULL, 0, 0, NULL ); cid.UniqueProcess = 0; cid.UniqueThread = ULongToHandle( GetCurrentThreadId() ); status = pNtOpenThread( &h1, 0, &attr, &cid ); - todo_wine ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status ); - if (NT_SUCCESS(status)) CloseHandle( h1 ); + ok( status == STATUS_ACCESS_DENIED, "got %#lx.\n", status );
h1 = CreateWindowStationA( "WinSta0", 0, WINSTA_ALL_ACCESS, NULL ); err = GetLastError(); @@ -3728,8 +3707,8 @@ static void test_zero_access(void) CloseWindowStation( h1 ); h1 = CreateWindowStationA( "WinSta0", 0, 0, NULL ); err = GetLastError(); - todo_wine ok( !h1, "CreateWindowStationA succeeded\n" ); - todo_wine ok( err == ERROR_ACCESS_DENIED, "CreateWindowStationA failed %lu\n", err ); + ok( !h1, "CreateWindowStationA succeeded\n" ); + ok( err == ERROR_ACCESS_DENIED, "CreateWindowStationA failed %lu\n", err ); if (h1) CloseWindowStation( h1 ); } else if (err == ERROR_ACCESS_DENIED) win_skip( "Not enough privileges for CreateWindowStation\n" ); @@ -3739,8 +3718,8 @@ static void test_zero_access(void) CloseWindowStation( h1 ); h1 = OpenWindowStationA( "WinSta0", TRUE, 0 ); err = GetLastError(); - todo_wine ok( !h1, "OpenWindowStation succeeeded\n" ); - todo_wine ok( err == ERROR_ACCESS_DENIED, "OpenWindowStation failed %lu\n", err ); + ok( !h1, "OpenWindowStation succeeeded\n" ); + ok( err == ERROR_ACCESS_DENIED, "OpenWindowStation failed %lu\n", err ); if (h1) CloseWindowStation( h1 );
h1 = CreateDesktopA( "default", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL ); @@ -3749,8 +3728,8 @@ static void test_zero_access(void) SetLastError( 0xdeadbeef ); h1 = CreateDesktopA( "default", NULL, NULL, 0, 0, NULL ); err = GetLastError(); - todo_wine ok( !h1, "CreateDesktopA succeeded\n" ); - todo_wine ok( err == ERROR_ACCESS_DENIED, "CreateDesktopA failed %lu\n", err ); + ok( !h1, "CreateDesktopA succeeded\n" ); + ok( err == ERROR_ACCESS_DENIED, "CreateDesktopA failed %lu\n", err ); if (h1) CloseDesktop( h1 );
h1 = OpenDesktopA( "default", 0, TRUE, DESKTOP_ALL_ACCESS ); diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c index f264f42e98d..2760c1b4472 100644 --- a/dlls/ntdll/tests/reg.c +++ b/dlls/ntdll/tests/reg.c @@ -253,9 +253,7 @@ static void test_NtOpenKey(void) attr.Length = sizeof(attr); key = (HANDLE)0xdeadbeef; status = pNtOpenKey(&key, 0, &attr); - todo_wine ok(status == STATUS_ACCESS_DENIED, "Expected STATUS_ACCESS_DENIED, got: 0x%08lx\n", status); - todo_wine ok(!key, "key = %p\n", key); if (status == STATUS_SUCCESS) NtClose(key);
diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index 7194dc403d7..dd8b2f4ffee 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -2292,19 +2292,15 @@ static void test_permanence(void) status = ZwOpenDirectoryObject( &handle, DIRECTORY_ALL_ACCESS, &attr ); ok(!status, "got %#lx\n", status); status = ZwMakeTemporaryObject( handle ); - todo_wine ok(!status, "got %#lx\n", status); status = ZwMakeTemporaryObject( handle ); - todo_wine ok(!status, "got %#lx\n", status); status = ZwClose( handle ); ok(!status, "got %#lx\n", status); status = ZwOpenDirectoryObject( &handle, 0, &attr ); - todo_wine ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#lx\n", status);
status = ZwCreateDirectoryObject( &handle, GENERIC_ALL, &attr ); - todo_wine ok(!status, "got %#lx\n", status); attr.Attributes = OBJ_PERMANENT; status = ZwOpenDirectoryObject( &handle2, DIRECTORY_ALL_ACCESS, &attr ); @@ -2312,11 +2308,9 @@ static void test_permanence(void) status = ZwClose( handle2 ); ok(!status, "got %#lx\n", status); status = ZwClose( handle ); - todo_wine ok(!status, "got %#lx\n", status); attr.Attributes = 0; status = ZwOpenDirectoryObject( &handle, 0, &attr ); - todo_wine ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#lx\n", status); if (!status) ZwClose( handle ); } diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index c5c0114b2b7..0c902ce783b 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -1948,11 +1948,9 @@ static void test_device_key(void)
SetLastError(0xdeadbeef); key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, 0); -todo_wine { ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n"); ok(GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_ACCESS_DENIED, /* win2k3 */ "Got unexpected error %#lx.\n", GetLastError()); -}
key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_READ); ok(key != INVALID_HANDLE_VALUE, "Failed to open device key, error %#lx.\n", GetLastError()); diff --git a/server/device.c b/server/device.c index cab09700d8c..1f93cca437d 100644 --- a/server/device.c +++ b/server/device.c @@ -1003,7 +1003,7 @@ DECL_HANDLER(get_next_device_request)
if (iosb && iosb->in_size > get_reply_max_size()) set_error( STATUS_BUFFER_OVERFLOW ); - else if (!irp->file || (reply->next = alloc_handle( current->process, irp, 0, 0 ))) + else if (!irp->file || (reply->next = alloc_handle_no_access_check( current->process, irp, 0, 0 ))) { if (fill_irp_params( manager, irp, &reply->params )) { @@ -1137,7 +1137,7 @@ DECL_HANDLER(get_kernel_object_handle) return;
if ((ref = kernel_object_from_ptr( manager, req->user_ptr ))) - reply->handle = alloc_handle( current->process, ref->object, req->access, 0 ); + reply->handle = alloc_handle_no_access_check( current->process, ref->object, req->access, 0 ); else set_error( STATUS_INVALID_HANDLE );
diff --git a/server/handle.c b/server/handle.c index e65831b3b22..b7e9cf80121 100644 --- a/server/handle.c +++ b/server/handle.c @@ -284,7 +284,12 @@ obj_handle_t alloc_handle( struct process *process, void *ptr, unsigned int acce { struct object *obj = ptr; access = obj->ops->map_access( obj, access ) & ~RESERVED_ALL; - if (access && !check_object_access( NULL, obj, &access )) return 0; + if (!access) + { + set_error( STATUS_ACCESS_DENIED ); + return 0; + } + if (!check_object_access( NULL, obj, &access )) return 0; return alloc_handle_entry( process, ptr, access, attr ); }