This matches Windows behaviour. In particular, redirecting stderr with freopen() followed by assert(0) will print the failure message to the relevant file.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- The motivation for this patch is that WriteConsoleW() and therefore _cwprintf() consistently swallow messages when I try to run Wine tests. I don't know if this is a bug, but it turns out there was an easier fix than trying to delve into console code...
dlls/msvcrt/exit.c | 2 +- dlls/msvcrt/msvcrt.h | 3 +++ dlls/msvcrt/scanf.c | 2 -- 3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c index f631d4d727b..cb38b35de9a 100644 --- a/dlls/msvcrt/exit.c +++ b/dlls/msvcrt/exit.c @@ -305,7 +305,7 @@ void CDECL MSVCRT__wassert(const MSVCRT_wchar_t* str, const MSVCRT_wchar_t* file DoMessageBoxW(assertion_failed, text); } else - _cwprintf(format_console, str, file, line); + MSVCRT_fwprintf(MSVCRT_stderr, format_console, str, file, line);
MSVCRT_raise(MSVCRT_SIGABRT); MSVCRT__exit(3); diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 3ffc785d065..dc89c6af23e 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -447,6 +447,8 @@ struct MSVCRT__iobuf {
typedef struct MSVCRT__iobuf MSVCRT_FILE;
+extern MSVCRT_FILE MSVCRT__iob[]; + struct MSVCRT_lconv { char* decimal_point; char* thousands_sep; @@ -1107,6 +1109,7 @@ MSVCRT___time32_t __cdecl MSVCRT__time32(MSVCRT___time32_t*); MSVCRT___time64_t __cdecl MSVCRT__time64(MSVCRT___time64_t*); MSVCRT_FILE* __cdecl MSVCRT__fdopen(int, const char *); MSVCRT_FILE* __cdecl MSVCRT__wfdopen(int, const MSVCRT_wchar_t *); +int WINAPIV MSVCRT_fwprintf(MSVCRT_FILE *file, const MSVCRT_wchar_t *format, ...); int __cdecl MSVCRT_vsnprintf(char *str, MSVCRT_size_t len, const char *format, __ms_va_list valist); int __cdecl MSVCRT_vsnwprintf(MSVCRT_wchar_t *str, MSVCRT_size_t len, const MSVCRT_wchar_t *format, __ms_va_list valist ); diff --git a/dlls/msvcrt/scanf.c b/dlls/msvcrt/scanf.c index 04f87077e16..4b2ac2ed4a1 100644 --- a/dlls/msvcrt/scanf.c +++ b/dlls/msvcrt/scanf.c @@ -35,8 +35,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
-extern MSVCRT_FILE MSVCRT__iob[]; - /* helper function for *scanf. Returns the value of character c in the * given base, or -1 if the given character is not a digit of the base. */