Zebediah Figura : msvcrt: Print assertion failure messages to stderr.

Alexandre Julliard julliard at winehq.org
Tue Jun 30 14:55:05 CDT 2020


Module: wine
Branch: master
Commit: 3533605293e8083dae19c5fbd41e2077faf5adc6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3533605293e8083dae19c5fbd41e2077faf5adc6

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Jun 29 15:12:22 2020 -0500

msvcrt: Print assertion failure messages to stderr.

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 at codeweavers.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 f631d4d727..cb38b35de9 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 3ffc785d06..dc89c6af23 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 04f87077e1..4b2ac2ed4a 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.
  */




More information about the wine-cvs mailing list