2022-05-31 15:20:45 -07:00
|
|
|
From da81169743bd7f070186ec5e58c89bab53d0bb7f Mon Sep 17 00:00:00 2001
|
2014-09-28 14:54:50 -07:00
|
|
|
From: Sebastian Lackner <sebastian@fds-team.de>
|
|
|
|
Date: Sun, 28 Sep 2014 23:39:51 +0200
|
2020-07-28 16:47:49 -07:00
|
|
|
Subject: [PATCH] ntdll: OutputDebugString should throw the exception a second
|
|
|
|
time, if a debugger is attached.
|
2014-09-28 14:54:50 -07:00
|
|
|
|
|
|
|
---
|
2019-09-09 16:52:44 -07:00
|
|
|
dlls/kernelbase/debug.c | 17 +++++++++++++++++
|
2020-07-28 16:47:49 -07:00
|
|
|
dlls/ntdll/tests/exception.c | 9 ++++-----
|
|
|
|
2 files changed, 21 insertions(+), 5 deletions(-)
|
2014-09-28 14:54:50 -07:00
|
|
|
|
2019-09-09 16:52:44 -07:00
|
|
|
diff --git a/dlls/kernelbase/debug.c b/dlls/kernelbase/debug.c
|
2022-05-31 15:20:45 -07:00
|
|
|
index 9e954e3ffbe..a6793c20204 100644
|
2019-09-09 16:52:44 -07:00
|
|
|
--- a/dlls/kernelbase/debug.c
|
|
|
|
+++ b/dlls/kernelbase/debug.c
|
2022-03-18 21:02:16 -07:00
|
|
|
@@ -200,6 +200,23 @@ void WINAPI DECLSPEC_HOTPATCH OutputDebugStringA( LPCSTR str )
|
2014-09-28 14:54:50 -07:00
|
|
|
__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
|
2022-05-31 15:20:45 -07:00
|
|
|
index 3e76b001147..0c02486e19c 100644
|
2014-09-28 14:54:50 -07:00
|
|
|
--- a/dlls/ntdll/tests/exception.c
|
|
|
|
+++ b/dlls/ntdll/tests/exception.c
|
2022-05-31 15:20:45 -07:00
|
|
|
@@ -8345,7 +8345,7 @@ static LONG CALLBACK outputdebugstring_vectored_handler(EXCEPTION_POINTERS *Exce
|
2014-09-28 14:54:50 -07:00
|
|
|
return EXCEPTION_CONTINUE_SEARCH;
|
|
|
|
}
|
|
|
|
|
|
|
|
-static void test_outputdebugstring(DWORD numexc, BOOL todo)
|
|
|
|
+static void test_outputdebugstring(DWORD numexc)
|
|
|
|
{
|
|
|
|
PVOID vectored_handler;
|
|
|
|
|
2022-05-31 15:20:45 -07:00
|
|
|
@@ -8361,7 +8361,6 @@ static void test_outputdebugstring(DWORD numexc, BOOL todo)
|
2014-09-28 14:54:50 -07:00
|
|
|
outputdebugstring_exceptions = 0;
|
|
|
|
OutputDebugStringA("Hello World");
|
|
|
|
|
2016-02-10 10:06:04 -08:00
|
|
|
- todo_wine_if(todo)
|
2022-03-18 21:02:16 -07:00
|
|
|
ok(outputdebugstring_exceptions == numexc, "OutputDebugStringA generated %ld exceptions, expected %ld\n",
|
2016-02-10 10:06:04 -08:00
|
|
|
outputdebugstring_exceptions, numexc);
|
|
|
|
|
2022-05-31 15:20:45 -07:00
|
|
|
@@ -10785,9 +10784,9 @@ START_TEST(exception)
|
2020-08-11 17:17:01 -07:00
|
|
|
else skip( "RtlRaiseException not found\n" );
|
2020-07-28 16:47:49 -07:00
|
|
|
#endif
|
2020-08-11 17:17:01 -07:00
|
|
|
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;
|
2022-05-31 15:20:45 -07:00
|
|
|
@@ -10900,7 +10899,7 @@ START_TEST(exception)
|
2021-01-06 18:15:41 -08:00
|
|
|
test_debugger(DBG_EXCEPTION_HANDLED);
|
|
|
|
test_debugger(DBG_CONTINUE);
|
2020-07-28 16:47:49 -07:00
|
|
|
test_thread_context();
|
2014-09-28 14:54:50 -07:00
|
|
|
- test_outputdebugstring(1, FALSE);
|
|
|
|
+ test_outputdebugstring(1);
|
|
|
|
test_ripevent(1);
|
2022-05-31 15:20:45 -07:00
|
|
|
test_fastfail();
|
2016-02-19 11:08:55 -08:00
|
|
|
test_breakpoint(1);
|
2014-09-28 14:54:50 -07:00
|
|
|
--
|
2022-05-31 15:20:45 -07:00
|
|
|
2.36.1
|
2014-09-28 14:54:50 -07:00
|
|
|
|