build: Check for invalid parameter overriding on Windows

Allow one to override the invalid parameter handler if we have the
following items:

* _set_invalid_parameter_hander() or
  _set_thread_local_parameter_handler()
* _CrtSetReportMode() as a function or macro

Currently, we are doing this on Visual Studio to allow GSpawn to work on
Windows as well as having the log writer support color output, as we
might be passing in file descriptors that are invalid, which will cause
the CRT to abort unless the default invalid parameter handler is
overridden.
This commit is contained in:
Chun-wei Fan
2022-11-02 23:55:48 +08:00
parent 92730c6226
commit b92b17f021
4 changed files with 26 additions and 6 deletions

View File

@@ -121,6 +121,12 @@ GMainContext * g_get_worker_context (void);
gboolean g_check_setuid (void);
GMainContext * g_main_context_new_with_next_id (guint next_id);
#if (defined (HAVE__SET_THREAD_LOCAL_INVALID_PARAMETER_HANDLER) || \
defined (HAVE__SET_INVALID_PARAMETER_HANDLER)) && \
defined (HAVE__CRT_SET_REPORT_MODE)
# define USE_INVALID_PARAMETER_HANDLER
#endif
#ifdef G_OS_WIN32
GLIB_AVAILABLE_IN_ALL
gchar *_glib_get_locale_dir (void);