Today, Wine uses NtQueryInformationProcess/ProcessDebugPort to detect whether the current process is being debugged. If it is, the process issues a breakpoint to yield control to the debugger.
Some debuggers (e.g. latest CDB) appear to create debug handles with restricted DACL, which causes querying debug port to fail with STATUS_ACCESS_DENIED. This results in the debuggee erroneously skipping the initial breakpoint.
Fix this by not requiring DEBUG_ALL_ACCESS when opening the debug port object. Instead, use MAXIMUM_ALLOWED for the access mask.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52184 Signed-off-by: Jinoh Kang jinoh.kang.kr@gmail.com --- dlls/ntdll/tests/info.c | 4 ---- server/process.c | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index 4d6104b7502..a821dada902 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -3534,20 +3534,16 @@ static void test_debuggee_dbgport(int argc, char **argv)
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessDebugPort, &debug_port, sizeof(debug_port), NULL ); - todo_wine_if(access != DEBUG_ALL_ACCESS && access != GENERIC_ALL) ok( !status, "NtQueryInformationProcess ProcessDebugPort failed, status %#x.\n", status ); - todo_wine_if(access != DEBUG_ALL_ACCESS && access != GENERIC_ALL) ok( debug_port == ~(DWORD_PTR)0, "Expected port %#lx, got %#lx.\n", ~(DWORD_PTR)0, debug_port );
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessDebugFlags, &debug_flags, sizeof(debug_flags), NULL ); - todo_wine_if(access != DEBUG_ALL_ACCESS && access != GENERIC_ALL) ok( !status, "NtQueryInformationProcess ProcessDebugFlags failed, status %#x.\n", status );
expect_status = access ? STATUS_SUCCESS : STATUS_ACCESS_DENIED; status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessDebugObjectHandle, &handle, sizeof(handle), NULL ); - todo_wine_if(access != DEBUG_ALL_ACCESS && access != GENERIC_ALL) ok( status == expect_status, "NtQueryInformationProcess ProcessDebugObjectHandle expected status %#x, actual %#x.\n", expect_status, status ); if (SUCCEEDED( status )) NtClose( handle );
diff --git a/server/process.c b/server/process.c index 6d794ba5ead..81c94a3c81d 100644 --- a/server/process.c +++ b/server/process.c @@ -1528,7 +1528,7 @@ DECL_HANDLER(get_process_debug_info)
reply->debug_children = process->debug_children; if (!process->debug_obj) set_error( STATUS_PORT_NOT_SET ); - else reply->debug = alloc_handle( current->process, process->debug_obj, DEBUG_ALL_ACCESS, 0 ); + else reply->debug = alloc_handle( current->process, process->debug_obj, MAXIMUM_ALLOWED, 0 ); release_object( process ); }