diff --git a/test/tcheck_version.c b/test/tcheck_version.c index 49c86c239bb..bfc8daf315b 100644 --- a/test/tcheck_version.c +++ b/test/tcheck_version.c @@ -29,6 +29,10 @@ #include "h5test.h" +#ifdef H5_HAVE_WIN32_API +#include +#endif + #define progname "tcheck_version" /* prototypes */ @@ -108,12 +112,31 @@ abort_intercept(int H5_ATTR_UNUSED sig) HDexit(6); } +#ifdef H5_HAVE_WIN32_API +/* Turns off the modal dialog that is raised when the Windows CRT calls abort(). + * + * Returning TRUE here lets Windows know that we've handled the abort() and that there + * is no need to alert the user with a modal dialog box. + */ +int +handle_crt_abort(int reportType, char *message, int *returnValue) +{ + return TRUE; +} +#endif + int main(int ac, char **av) { +#ifdef H5_HAVE_WIN32_API + (void)_CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, handle_crt_abort); +#endif parse(ac, av); HDsignal(SIGABRT, &abort_intercept); H5check_version(major, minor, release); HDsignal(SIGABRT, SIG_DFL); +#ifdef H5_HAVE_WIN32_API + (void)_CrtSetReportHook2(_CRT_RPTHOOK_REMOVE, handle_crt_abort); +#endif return 0; }