[PATCH v5 0/2] MR10250: Call abort if _wassert error behavior is set to _OUT_TO_STDERR and trigger a debug break.
If assert is called when error mode is set to _OUT_TO_STDERR and abort behavior is set to _WRITE_ABORT_MSG the abort message box is still showed in Windows. Some applications do this and don't trigger a break point in Wine because abort is never called. Note: Windows actually triggers an exception in abort, instead of calling DebugBreak. I suppose this is the behavior of ReportFault, but it's not implemented. -- v5: msvcrt: Call abort at the end of _wassert. https://gitlab.winehq.org/wine/wine/-/merge_requests/10250
From: Santino Mazza <smazza@codeweavers.com> --- dlls/msvcrt/exit.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c index c8db6c405da..e018b330522 100644 --- a/dlls/msvcrt/exit.c +++ b/dlls/msvcrt/exit.c @@ -265,7 +265,14 @@ void CDECL abort(void) _cputs("\nabnormal program termination\n"); } #endif + raise(SIGABRT); + +#if _MSVCR_VER >= 140 + if (MSVCRT_abort_behavior & _CALL_REPORTFAULT) + __fastfail(FAST_FAIL_FATAL_APP_EXIT); +#endif + /* in case raise() returns */ _exit(3); } @@ -279,8 +286,6 @@ unsigned int CDECL _set_abort_behavior(unsigned int flags, unsigned int mask) unsigned int old = MSVCRT_abort_behavior; TRACE("%x, %x\n", flags, mask); - if (mask & _CALL_REPORTFAULT) - FIXME("_WRITE_CALL_REPORTFAULT unhandled\n"); MSVCRT_abort_behavior = (MSVCRT_abort_behavior & ~mask) | (flags & mask); return old; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10250
From: Santino Mazza <smazza@codeweavers.com> If assert is called when error mode is set to _OUT_TO_STDERR and abort behavior is set to _WRITE_ABORT_MSG the abort message box is still showed in Windows. Some applications do this and the abort exception is still raised in the debugger on Windows. --- dlls/msvcrt/exit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c index e018b330522..481b8b5e3f7 100644 --- a/dlls/msvcrt/exit.c +++ b/dlls/msvcrt/exit.c @@ -305,12 +305,12 @@ void DECLSPEC_NORETURN CDECL _wassert(const wchar_t* str, const wchar_t* file, u wchar_t text[2048]; _snwprintf(text, sizeof(text), L"File: %ls\nLine: %d\n\nExpression: \"%ls\"", file, line, str); DoMessageBoxW(L"Assertion failed!", text); + raise(SIGABRT); + _exit(3); } - else - fwprintf(stderr, L"Assertion failed: %ls, file %ls, line %d\n\n", str, file, line); - raise(SIGABRT); - _exit(3); + fwprintf(stderr, L"Assertion failed: %ls, file %ls, line %d\n\n", str, file, line); + abort(); } /********************************************************************* -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10250
On Wed Mar 11 13:24:48 2026 +0000, Santino Mazza wrote:
I think it might be implemented differently, because I don't get any exceptions or breakpoints in x86dbg when `_CALL_REPORT_FAULT` is set in msvcr, only with ucrtbase. It's hard to comment without seeing your tests but I have checked that I'm getting an 0xc0000409 exception with msvcr120.dll.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10250#note_131834
participants (3)
-
Piotr Caban (@piotr) -
Santino Mazza -
Santino Mazza (@tati)