Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntdll/tests/exception.c | 39 +++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 07e05e45c90..71bca51a31f 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -974,7 +974,8 @@ static void test_debugger(void) char cmdline[MAX_PATH]; PROCESS_INFORMATION pi; STARTUPINFOA si = { 0 }; - DEBUG_EVENT de; + DEBUG_EVENT de, de0, de1; + HANDLE thread; DWORD continuestatus; PVOID code_mem_address = NULL; NTSTATUS status; @@ -1004,6 +1005,42 @@ static void test_debugger(void) ok(!ret, "ContinueDebugEvent unexpectedly succeeded\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected last error: %u\n", GetLastError());
+ if (!ContinueDebugEvent(de.dwProcessId, de.dwThreadId, DBG_REPLY_LATER)) + todo_wine win_skip("Skipping unsupported DBG_REPLY_LATER tests\n"); + else + { + ok(WaitForDebugEvent(&de0, 50), "WaitForDebugEvent failed, last error:%u\n", GetLastError()); + ok(de.dwDebugEventCode == de0.dwDebugEventCode, "delayed event differ, code:%x was:%x\n", de0.dwDebugEventCode, de.dwDebugEventCode); + ok(de.dwProcessId == de0.dwProcessId, "delayed event differ, pid:%x was:%x\n", de0.dwProcessId, de.dwProcessId); + ok(de.dwThreadId == de0.dwThreadId, "delayed event differ, tid:%x was:%x\n", de0.dwThreadId, de.dwThreadId); + + if (de.dwDebugEventCode != CREATE_PROCESS_DEBUG_EVENT && + de.dwDebugEventCode != CREATE_THREAD_DEBUG_EVENT && + de.dwDebugEventCode != EXIT_THREAD_DEBUG_EVENT && + de.dwDebugEventCode != EXIT_PROCESS_DEBUG_EVENT) + { + thread = OpenThread(THREAD_SUSPEND_RESUME, FALSE, de.dwThreadId); + ok(thread != INVALID_HANDLE_VALUE, "OpenThread failed, last error:%u\n", GetLastError()); + + status = NtSuspendThread(thread, NULL); + ok(!status, "NtSuspendThread failed, last error:%u\n", GetLastError()); + + ok(ContinueDebugEvent(de.dwProcessId, de.dwThreadId, DBG_REPLY_LATER), + "ContinueDebugEvent failed, last error:%u\n", GetLastError()); + + ok(!WaitForDebugEvent(&de1, 50), "WaitForDebugEvent succeeded.\n"); + status = NtResumeThread(thread, NULL); + + ok(!status, "NtResumeThread failed, last error:%u\n", GetLastError()); + CloseHandle(thread); + + ok(WaitForDebugEvent(&de1, 50), "WaitForDebugEvent failed, last error:%u\n", GetLastError()); + ok(de.dwDebugEventCode == de1.dwDebugEventCode, "delayed event differ, code:%x was:%x\n", de1.dwDebugEventCode, de.dwDebugEventCode); + ok(de.dwProcessId == de1.dwProcessId, "delayed event differ, pid:%x was:%x\n", de1.dwProcessId, de.dwProcessId); + ok(de.dwThreadId == de1.dwThreadId, "delayed event differ, tid:%x was:%x\n", de1.dwThreadId, de.dwThreadId); + } + } + if (de.dwThreadId != pi.dwThreadId) { trace("event %d not coming from main thread, ignoring\n", de.dwDebugEventCode);