wine-staging/patches/ntdll-Exception/0002-ntdll-OutputDebugString-should-throw-the-exception-a.patch
Sebastian Lackner b7ac6188f9 Rebase against 9c98d632779862aae15e9e3a25f59065fae03386.
[mmsystem.dll16-Fix_Argument_Order]
Removed patch to fix argument order in GlobalAlloc16 call (accepted upstream).

[msvideo-MCIWNDM_SETTIMEFORMATA]
Removed patch to translate 16 bit address in lparam for MCIWNDM_SETTIMEFORMATA
message (accepted upstream).

[vcomp-Atomic_I8]
Removed patch to implement 64-bit atomic instructions in OpenMP (accepted
upstream).

[wined3d-CSMT_Main]
Temporarily disable patchset, needs rebasing.
2016-02-10 19:46:44 +01:00

94 lines
3.2 KiB
Diff

From 297d030a4189ce937662004426e21990e4736d25 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 28 Sep 2014 23:39:51 +0200
Subject: ntdll: OutputDebugString should throw the exception a second time, if
a debugger is attached.
---
dlls/kernel32/debugger.c | 17 +++++++++++++++++
dlls/ntdll/tests/exception.c | 11 +++++------
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/dlls/kernel32/debugger.c b/dlls/kernel32/debugger.c
index d4d66b2..981661b 100644
--- a/dlls/kernel32/debugger.c
+++ b/dlls/kernel32/debugger.c
@@ -277,6 +277,23 @@ void WINAPI OutputDebugStringA( LPCSTR str )
__ENDTRY
if (caught_by_dbg) return;
+ /* for some unknown reason Windows sends the exception a second time, if a
+ * debugger is attached, and the event wasn't handled in the first attempt */
+ if (NtCurrentTeb()->Peb->BeingDebugged)
+ {
+ __TRY
+ {
+ ULONG_PTR args[2];
+ args[0] = strlen(str) + 1;
+ args[1] = (ULONG_PTR)str;
+ RaiseException( DBG_PRINTEXCEPTION_C, 0, 2, args );
+ }
+ __EXCEPT(debug_exception_handler)
+ {
+ }
+ __ENDTRY
+ }
+
/* send string to a system-wide monitor */
if (!mutex_inited)
{
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index fc68ea5..693859d 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -1796,7 +1796,7 @@ static LONG CALLBACK outputdebugstring_vectored_handler(EXCEPTION_POINTERS *Exce
return EXCEPTION_CONTINUE_SEARCH;
}
-static void test_outputdebugstring(DWORD numexc, BOOL todo)
+static void test_outputdebugstring(DWORD numexc)
{
PVOID vectored_handler;
@@ -1812,7 +1812,6 @@ static void test_outputdebugstring(DWORD numexc, BOOL todo)
outputdebugstring_exceptions = 0;
OutputDebugStringA("Hello World");
- todo_wine_if(todo)
ok(outputdebugstring_exceptions == numexc, "OutputDebugStringA generated %d exceptions, expected %d\n",
outputdebugstring_exceptions, numexc);
@@ -2028,9 +2027,9 @@ START_TEST(exception)
run_rtlraiseexception_test(EXCEPTION_BREAKPOINT);
run_rtlraiseexception_test(EXCEPTION_INVALID_HANDLE);
test_stage = 3;
- test_outputdebugstring(0, FALSE);
+ test_outputdebugstring(0);
test_stage = 4;
- test_outputdebugstring(2, TRUE); /* is this a Windows bug? */
+ test_outputdebugstring(2);
test_stage = 5;
test_ripevent(0);
test_stage = 6;
@@ -2051,7 +2050,7 @@ START_TEST(exception)
test_exceptions();
test_rtlraiseexception();
test_debug_registers();
- test_outputdebugstring(1, FALSE);
+ test_outputdebugstring(1);
test_ripevent(1);
test_closehandle(0);
test_vectored_continue_handler();
@@ -2072,7 +2071,7 @@ START_TEST(exception)
"RtlLookupFunctionEntry" );
test_debug_registers();
- test_outputdebugstring(1, FALSE);
+ test_outputdebugstring(1);
test_ripevent(1);
test_closehandle(0);
test_vectored_continue_handler();
--
2.7.0