Example #1
0
int main()
#endif
{
	curl_global_init(CURL_GLOBAL_ALL);
	atexit([]() {
		undo_patches();
	});
	
	_set_abort_behavior(0, _WRITE_ABORT_MSG);
	_set_abort_behavior(0, _CALL_REPORTFAULT);

	std::shared_ptr<Spelunky> spelunky = Spelunky::GetDefaultSpelunky();
	if(spelunky != nullptr) {
#ifdef DEBUG_MODE
		int val = gui_operate(spelunky, nullptr);
#else
		int val = gui_operate(spelunky, (char*)LoadIcon(hInstance, MAKEINTRESOURCE(101)));
#endif
		undo_patches();
		curl_global_cleanup();
		return val;
	}
	else {
		MessageBox(NULL, "Spelunky is not running, please start it and then launch Frozlunky.", "Frozlunky", MB_OK);
		curl_global_cleanup();
		return 0;
	}
}
void CCrashHandler::SetProcessExceptionHandlers()
{
	// Install top-level SEH handler
	SetUnhandledExceptionFilter(SehHandler);    

	// Catch pure virtual function calls.
	// Because there is one _purecall_handler for the whole process, 
	// calling this function immediately impacts all threads. The last 
	// caller on any thread sets the handler. 
	// http://msdn.microsoft.com/en-us/library/t296ys27.aspx
	_set_purecall_handler(PureCallHandler);    

	// Catch new operator memory allocation exceptions
	_set_new_handler(NewHandler);

	// Catch invalid parameter exceptions.
	_set_invalid_parameter_handler(InvalidParameterHandler); 

	// Set up C++ signal handlers

	//_set_abort_behavior(_CALL_REPORTFAULT,_CALL_REPORTFAULT);
 	_set_abort_behavior(_WRITE_ABORT_MSG|_CALL_REPORTFAULT, _WRITE_ABORT_MSG|_CALL_REPORTFAULT);
 	_set_abort_behavior(0, _WRITE_ABORT_MSG);

	// Catch an abnormal program termination
	signal(SIGABRT, SigabrtHandler);  

	// Catch illegal instruction handler
	signal(SIGINT, SigintHandler);     

	// Catch a termination request
	signal(SIGTERM, SigtermHandler);          

}
Example #3
0
static void install_crash_handler() {
  if (!SymInitialize(GetCurrentProcess(), NULL, TRUE)) {
    fprintf(stderr, "SymInitialize failed: %d\n", GetLastError());
  }
  SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)crash_handler);
  _set_abort_behavior(0, _WRITE_ABORT_MSG);
  _set_abort_behavior(0, _CALL_REPORTFAULT);
  signal(SIGABRT, abort_handler);
}
Example #4
0
void yarp::os::abort(bool verbose)
{
#if defined(WIN32)
    if (verbose==false)
    {
        //to suppress windows dialog message
        _set_abort_behavior(0, _WRITE_ABORT_MSG);
        _set_abort_behavior(0, _CALL_REPORTFAULT);
    }
#endif
    ACE_OS::abort();   // exit is not recommended in processes with multi thread, see http://www.cplusplus.com/reference/cstdlib/exit/ and http://www.cplusplus.com/reference/cstdlib/abort/
}
MONGO_INITIALIZER(Behaviors_Win32)(InitializerContext*) {
    // do not display dialog on abort()
    _set_abort_behavior(0, _CALL_REPORTFAULT | _WRITE_ABORT_MSG);

    // hook the C runtime's error display
    _CrtSetReportHook(crtDebugCallback);

    if (_setmaxstdio(2048) == -1) {
        warning() << "Failed to increase max open files limit from default of 512 to 2048";
    }

    // Let's try to set minimum Windows Kernel quantum length to smallest viable timer resolution in
    // order to allow sleepmillis() to support waiting periods below Windows default quantum length
    // (which can vary per Windows version)
    // See https://msdn.microsoft.com/en-us/library/windows/desktop/dd743626(v=vs.85).aspx
    TIMECAPS tc;
    int targetResolution = 1;
    int timerResolution;

    if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) != TIMERR_NOERROR) {
        warning() << "Failed to read timer resolution range.";
        if (timeBeginPeriod(1) != TIMERR_NOERROR) {
            warning() << "Failed to set minimum timer resolution to 1 millisecond.";
        }
    } else {
        timerResolution =
            std::min(std::max(int(tc.wPeriodMin), targetResolution), int(tc.wPeriodMax));
        invariant(timeBeginPeriod(timerResolution) == TIMERR_NOERROR);
    }

    return Status::OK();
}
Example #6
0
File: Os.c Project: tata-/ohNet-1
int32_t OsCreate()
{
    FILETIME ft;
    WSADATA wsaData;
    WORD ver = (2<<8)|2; // WinSock v2.2.  Standard on XP and later

    char* noErrDlgs = getenv("OHNET_NO_ERROR_DIALOGS");
    if (noErrDlgs != NULL && strcmp(noErrDlgs, "1") == 0) {
        _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
    }

    GetSystemTimeAsFileTime(&ft);
    gStartTime = ft.dwHighDateTime;
    gStartTime <<= 32;
    gStartTime |= ft.dwLowDateTime;

    gTlsIndex = TlsAlloc();
    if (TLS_OUT_OF_INDEXES == gTlsIndex) {
        return -1;
    }
    gMutex = OsMutexCreate("");
    if (kHandleNull == gMutex) {
        TlsFree(gTlsIndex);
        return -1;
    }
    if (0 != WSAStartup(ver, &wsaData)) {
        OsMutexDestroy(gMutex);
        TlsFree(gTlsIndex);
        return -1;
    }
    gDebugSymbolHandle = GetCurrentProcess();
    (void)SymInitialize(gDebugSymbolHandle, NULL, TRUE);

    return 0;
}
void exception_catcher::set_process_exception_handlers()
{
    // Install top-level SEH handler
    SetUnhandledExceptionFilter(catched_seh_handler);

    // Catch pure virtual function calls.
    // Because there is one _purecall_handler for the whole process,
    // calling this function immediately impacts all threads. The last
    // caller on any thread sets the handler.
    // http://msdn.microsoft.com/en-us/library/t296ys27.aspx
    _set_purecall_handler(catched_pure_call_handler);

    // Catch new operator memory allocation exceptions
    _set_new_handler(catched_new_handler);

    // Catch invalid parameter exceptions.
    _set_invalid_parameter_handler(catched_invalid_parameter_handler);

    // Set up C++ signal handlers

    _set_abort_behavior(_CALL_REPORTFAULT, _CALL_REPORTFAULT);

    // Catch an abnormal program termination
    signal(SIGABRT, catched_sigabrt_handler);

    // Catch illegal instruction handler
    signal(SIGINT, catched_sigint_handler);

    // Catch a termination request
    signal(SIGTERM, catched_sigterm_handler);
}
Example #8
0
/*
 * ut_sigaction -- a sigaction that cannot return < 0
 */
int
ut_sigaction(const char *file, int line, const char *func,
		int signum, struct sigaction *act, struct sigaction *oldact)
{
#ifndef _WIN32
	int retval = sigaction(signum, act, oldact);
	if (retval != 0)
		ut_fatal(file, line, func, "!sigaction: %s", strsignal(signum));
	return retval;
#else
	if (signum == SIGABRT) {
		DWORD dwMode = GetErrorMode();
		SetErrorMode(dwMode | SEM_NOGPFAULTERRORBOX |
			SEM_FAILCRITICALERRORS);
		_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
	}
	if (signum == SIGSEGV) {
		Sa_handler = act->sa_handler;
		Signum = signum;
		AddVectoredExceptionHandler(0, exception_handler);
	}

	_crt_signal_t retval = signal(signum, act->sa_handler);
	if (retval == SIG_ERR)
		ut_fatal(file, line, func, "!signal: %d", signum);

	if (oldact != NULL) {
		oldact->sa_handler = retval;
	}
	return 0;
#endif
}
Example #9
0
void
_assert (
    const char *exp,
    const char *file,
    unsigned line)
{
    char achProgram[MAX_PATH];
    char *pszBuffer;
    size_t len;
    int iResult;

    /* First common debug message */
    FIXME("Assertion failed: %s, file %s, line %d\n", exp, file, line);

    /* Check if output should go to stderr */
    if (((msvcrt_error_mode == _OUT_TO_DEFAULT) && (__app_type == _CONSOLE_APP)) ||
        (msvcrt_error_mode == _OUT_TO_STDERR))
    {
        /* Print 'Assertion failed: x<y, file foo.c, line 45' to stderr */
        fprintf(stderr, "Assertion failed: %s, file %s, line %u\n", exp, file, line);
        abort();
    }

    /* Get the file name of the module */
    len = GetModuleFileNameA(NULL, achProgram, sizeof(achProgram));

    /* Calculate full length of the message */
    len += sizeof(formatstr) + len + strlen(exp) + strlen(file);

    /* Allocate a buffer */
    pszBuffer = malloc(len + 1);

    /* Format a message */
    _snprintf(pszBuffer, len, formatstr, achProgram, file, line, exp);

    /* Display a message box */
    iResult = __crt_MessageBoxA(pszBuffer, MB_ABORTRETRYIGNORE | MB_ICONERROR);

    /* Free the buffer */
    free(pszBuffer);

    /* Does the user want to ignore? */
    if (iResult == IDIGNORE)
    {
        /* Just return to the caller */
        return;
    }

    /* Does the user want to debug? */
    if (iResult == IDRETRY)
    {
        /* Break and return to the caller */
        __debugbreak();
        return;
    }

    /* Reset all abort flags (we don*t want another message box) and abort */
    _set_abort_behavior(0, 0xffffffff);
    abort();
}
void
setup_test_environment (void)
{
#if defined _WIN32
#   if defined _MSC_VER
    _set_abort_behavior( 0, _WRITE_ABORT_MSG);
    _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
    _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
#   endif
#else
#if defined ZMQ_HAVE_CYGWIN
    // abort test after 121 seconds
    alarm(121);
#else
#   if !defined ZMQ_DISABLE_TEST_TIMEOUT
    // abort test after 60 seconds
    alarm(60);
#   endif
#endif
#endif
#if defined __MVS__
    // z/OS UNIX System Services: Ignore SIGPIPE during test runs, as a
    // workaround for no SO_NOGSIGPIPE socket option.
    signal(SIGPIPE, SIG_IGN);
#endif
}
Example #11
0
void CrashLog_Init()
{
#ifdef _M_AMD64
	CONTEXT ctx;
	RtlCaptureContext(&ctx);

	/* The stack pointer for AMD64 must always be 16-byte aligned inside a
	 * function. As we are simulating a function call with the safe ESP value,
	 * we need to subtract 8 for the imaginary return address otherwise stack
	 * alignment would be wrong in the called function. */
	s_safe_esp = (void *)(ctx.Rsp - 8);
#else
#if defined(_MSC_VER)
	_asm {
		mov s_safe_esp, esp
	}
#else
	__asm__("movl %esp, _s_safe_esp");
#endif
#endif

	/* SIGABRT is not an unhandled exception, so we need to intercept it. */
	signal(SIGABRT, CustomAbort);
#if defined(_MSC_VER)
	/* Don't show abort message as we will get the crashlog window anyway. */
	_set_abort_behavior(0, _WRITE_ABORT_MSG);
#endif
	SetUnhandledExceptionFilter(ExceptionHandler);
}
Example #12
0
static void
faulthandler_suppress_crash_report(void)
{
#ifdef MS_WINDOWS
    UINT mode;

    /* Configure Windows to not display the Windows Error Reporting dialog */
    mode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
    SetErrorMode(mode | SEM_NOGPFAULTERRORBOX);
#endif

#ifdef HAVE_SYS_RESOURCE_H
    struct rlimit rl;

    /* Disable creation of core dump */
    if (getrlimit(RLIMIT_CORE, &rl) != 0) {
        rl.rlim_cur = 0;
        setrlimit(RLIMIT_CORE, &rl);
    }
#endif

#ifdef _MSC_VER
    /* Visual Studio: configure abort() to not display an error message nor
       open a popup asking to report the fault. */
    _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif
}
Example #13
0
    MONGO_INITIALIZER(Behaviors_Win32)(InitializerContext*) {

        // do not display dialog on abort()
        _set_abort_behavior(0, _CALL_REPORTFAULT | _WRITE_ABORT_MSG);

        return Status::OK();
    }
Example #14
0
int main(int argc, char* argv[]) {
#ifdef _MSC_VER
    _set_abort_behavior(0, ~0);
#endif  // !_MSC_VER

    google::protobuf::compiler::CppDiffGenerator generator;
    return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
Example #15
0
void setup_test_environment()
{
#if defined _WIN32
    _set_abort_behavior( 0, _WRITE_ABORT_MSG);
    _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
    _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
#endif
}
Example #16
0
File: error.c Project: knugie/ruby
static void
die(void)
{
#if defined(_WIN32) && defined(RUBY_MSVCRT_VERSION) && RUBY_MSVCRT_VERSION >= 80
    _set_abort_behavior( 0, _CALL_REPORTFAULT);
#endif

    abort();
}
Example #17
0
void
ut_unsuppress_errmsg()
{
	if (Suppressed) {
		SetErrorMode(ErrMode);
		_set_abort_behavior(AbortBehave, _WRITE_ABORT_MSG |
			_CALL_REPORTFAULT);
		Suppressed = FALSE;
	}
}
Example #18
0
void
ut_suppress_errmsg()
{
	ErrMode = GetErrorMode();
	SetErrorMode(ErrMode | SEM_NOGPFAULTERRORBOX |
		SEM_FAILCRITICALERRORS);
	AbortBehave = _set_abort_behavior(0, _WRITE_ABORT_MSG |
		_CALL_REPORTFAULT);
	Suppressed = TRUE;
}
Example #19
0
/*
 * util_suppress_errmsg -- suppresses "abort" window on Windows if env variable
 * is set, useful for automatic tests
 */
void
util_suppress_errmsg(void)
{
	if (os_getenv("PMDK_NO_ABORT_MSG") != NULL) {
		DWORD err = GetErrorMode();
		SetErrorMode(err | SEM_NOGPFAULTERRORBOX |
			SEM_FAILCRITICALERRORS);
		_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
	}
}
Example #20
0
extern "C" void cbStartup()
{
	cbLock = CreateMutex( NULL, FALSE, NULL );
	cbReportData = NULL;

	swprintf_s( cbShareName, 256, L"CrashBack_%x", GetCurrentProcessId() );

	GetModuleFileName( NULL, cbReportExePath, MAX_PATH );
	wcscpy_s( cbReportExeDir, MAX_PATH, cbReportExePath );
	wchar_t *p = wcsrchr( cbReportExeDir, '\\' );
	if ( p )
		*p = 0;

	wcscpy_s( cbReportExePath, MAX_PATH, cbReportExeDir );
	wcscat_s( cbReportExePath, MAX_PATH, L"\\" );
	wcscat_s( cbReportExePath, MAX_PATH, L"crashreport.exe" );

	// Check that crashreport.exe exists in the app's directory.
	if ( GetFileAttributes( cbReportExePath ) == INVALID_FILE_ATTRIBUTES )
		return;

	swprintf_s( cbReportCmdLine, 1024, L"\"%s\" 0x%x", cbReportExePath, GetCurrentProcessId() );

	cbGetProgramName();
	cbGetCmdLine();

	// Set up shared memory to communicate with the report handler EXE.
	HANDLE hShared = CreateFileMapping(
		INVALID_HANDLE_VALUE,    // use paging file
		NULL,                    // default security
		PAGE_READWRITE,          // read/write access
		0,                       // max. object size
		sizeof(CbReport),        // buffer size
		cbShareName );           // name of mapping object
	if ( !hShared )
		return;

	cbReportData = (CbReport *)MapViewOfFile( hShared, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(CbReport) );
	if ( !cbReportData )
	{
		CloseHandle( hShared );
		return;
	}

	// Register the handlers.
	SetUnhandledExceptionFilter( &cbExceptionHandler );
	_set_error_mode( _OUT_TO_STDERR );
	_set_purecall_handler( cbPureCallHandler );
	_set_new_mode( 1 ); // malloc calls the new handler on failure
	_set_new_handler( cbNewHandler );
	_set_invalid_parameter_handler( cbInvalidParameterHandler );
	_set_abort_behavior( _CALL_REPORTFAULT, _CALL_REPORTFAULT );
}
Example #21
0
int main(int argc, char* argv[])
{
#ifdef _WIN32
	_set_error_mode(_OUT_TO_STDERR);
	_set_abort_behavior(0, _WRITE_ABORT_MSG);
#endif // _WIN32

	int result = 0;
	result = wgt::BWUnitTest::runTest("", argc, argv);

	return result;
}
Example #22
0
int
main (int argc, char **argv)
{
    bool verbose = false;
    test_item_t *test = 0;
    int argn;
    for (argn = 1; argn < argc; argn++) {
        if (streq (argv [argn], "-v"))
            verbose = true;
        else
        if (streq (argv [argn], "--nb")) {
            printf("%d\n", test_get_number ());
            return 0;
        }
        else
        if (streq (argv [argn], "--list")) {
            test_print_list ();
            return 0;
        }
        else
        if (streq (argv [argn], "--test")) {
            argn++;
            if (argn >= argc) {
                fprintf (stderr, "--test needs an argument\n");
                return 1;
            }
            test = test_available (argv [argn]);
            if (!test) {
                fprintf (stderr, "%s is not available\n", argv [argn]);
                return 1;
            }
        }
        else
        if (streq (argv [argn], "-e")) {
#ifdef _MSC_VER
            //  When receiving an abort signal, only print to stderr (no dialog)
            _set_abort_behavior (0, _WRITE_ABORT_MSG);
#endif
        }
        else {
            printf ("Unknown option: %s\n", argv [argn]);
            return 1;
        }
    }
    if (test) {
        printf ("Running czmq selftest '%s'...\n", test->testname);
        test->test (verbose);
    }
    else
        test_runall (verbose);

    return 0;
}
Example #23
0
File: Os.c Project: sewood/ohNet
OsContext* OsCreate()
{
    FILETIME ft;
    WSADATA wsaData;
    WORD ver = (2<<8)|2; // WinSock v2.2.  Standard on XP and later

    char* noErrDlgs = getenv("OHNET_NO_ERROR_DIALOGS");
    OsContext* ctx = malloc(sizeof(*ctx));
    if (noErrDlgs != NULL && strcmp(noErrDlgs, "1") == 0) {
        _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
    }
    if (ctx == NULL) {
        return NULL;
    }

    ctx->iInterfaceChangeObserver = NULL;
    ctx->iTestInterfaceIndex = -1;

    GetSystemTimeAsFileTime(&ft);
    ctx->iStartTime = ft.dwHighDateTime;
    ctx->iStartTime <<= 32;
    ctx->iStartTime |= ft.dwLowDateTime;
    ctx->iPrevTime = 0;
    ctx->iTimeAdjustment = 0;

    ctx->iTlsIndex = TlsAlloc();
    if (TLS_OUT_OF_INDEXES == ctx->iTlsIndex) {
        free(ctx);
        return NULL;
    }
    ctx->iMutex = OsMutexCreate(ctx, "");
    if (kHandleNull == ctx->iMutex) {
        TlsFree(ctx->iTlsIndex);
        free(ctx);
        return NULL;
    }
    if (0 != WSAStartup(ver, &wsaData)) {
        OsMutexDestroy(ctx->iMutex);
        TlsFree(ctx->iTlsIndex);
        free(ctx);
        return NULL;
    }
    {
        HMODULE hModule = GetModuleHandle(NULL);
        CHAR path[MAX_PATH];
        GetModuleFileName(hModule, path, MAX_PATH);
        ctx->iDebugSymbolHandle = GetCurrentProcess();
        (void)SymInitialize(ctx->iDebugSymbolHandle, /*NULL*/path, TRUE);
    }

    return ctx;
}
Example #24
0
void setup_test_environment()
{
#if defined _WIN32
#   if defined _MSC_VER
    _set_abort_behavior( 0, _WRITE_ABORT_MSG);
    _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
    _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
#   endif
#else
    // abort test after 60 seconds
    alarm(60);
#endif
}
Example #25
0
int CALLBACK
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    // Enable assertion failure message box
    // http://msdn.microsoft.com/en-us/library/sas1dkb2.aspx
    _set_error_mode(_OUT_TO_MSGBOX);
#ifdef _MSC_VER
    // Enable abort message box
    // http://msdn.microsoft.com/en-us/library/e631wekh.aspx
    _set_abort_behavior(0, _CALL_REPORTFAULT);
#endif
    assert(2 + 2 == 5);
    return 0;
}
Example #26
0
void setup_test_environment()
{
#if defined _WIN32
#   if defined _MSC_VER
    _set_abort_behavior( 0, _WRITE_ABORT_MSG);
    _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
    _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
#   endif
#endif
#if defined __MVS__
    // z/OS UNIX System Services: Ignore SIGPIPE during test runs, as a
    // workaround for no SO_NOGSIGPIPE socket option.
    signal(SIGPIPE, SIG_IGN);
#endif
}
Example #27
0
File: error.c Project: nurse/ruby
void
rb_bug(const char *fmt, ...)
{
    va_list args;

    va_start(args, fmt);
    report_bug(rb_sourcefile(), rb_sourceline(), fmt, args);
    va_end(args);

#if defined(_WIN32) && defined(RT_VER) && RT_VER >= 80
    _set_abort_behavior( 0, _CALL_REPORTFAULT);
#endif

    abort();
}
Example #28
0
int main(int argc, char** argv) {
	SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
	_set_abort_behavior(0, _WRITE_ABORT_MSG);

	try {
		if (argc != 5) {
			std::cout << "Usage: " << argv[0] << " [memSizeInMB] [timeInSec] [executable] [outFile]" << std::endl;
			return 1;
		}

		int memSize = atoi(argv[1]);
		int time = atoi(argv[2]);
		SandBoxRunner sandBoxRunner{ memSize, time };

		auto result = sandBoxRunner.runProcessWithName(argv[3], argv[4]);

		std::cout << std::endl;
		std::cout << "RESULT: ";
		switch (result) {
		case SandBoxRunner::NotEnoughMemory:
			std::cout << "NOT_ENOUGH_MEMORY" << std::endl;
			break;

		case SandBoxRunner::NotEnoughTime:
			std::cout << "NOT_ENOUGH_TIME" << std::endl;
			break;

		case SandBoxRunner::Success:
			std::cout << "SUCCESS" << std::endl;
			break;

		case SandBoxRunner::Unknown:
			std::cout << "UNKNOWN_ERROR" << std::endl;
			break;
		}
	}
	catch (std::runtime_error error) {
		std::cout << std::endl;
		std::cout << "ERROR: " <<  error.what() << std::endl;
		return 1;
	}

	return 0;
}
Example #29
0
File: error.c Project: evan/ruby
void
rb_bug(const char *fmt, ...)
{
    va_list args;
    const char *file = NULL;
    int line = 0;

    if (GET_THREAD()) {
	file = rb_sourcefile();
	line = rb_sourceline();
    }

    va_start(args, fmt);
    report_bug(file, line, fmt, args);
    va_end(args);

#if defined(_WIN32) && defined(RT_VER) && RT_VER >= 80
    _set_abort_behavior( 0, _CALL_REPORTFAULT);
#endif

    abort();
}
bool CrashHandlerWindows::registerCrashHandlers() {
	
	arx_assert(m_pPreviousCrashHandlers == 0);
	m_pPreviousCrashHandlers = new PlatformCrashHandlers;
	
	// Unhandled exception handler.
	m_pPreviousCrashHandlers->m_SEHHandler = SetUnhandledExceptionFilter(SEHHandler);
	
	// Prevent dialog box.
	_set_error_mode(_OUT_TO_STDERR);
	
	// Catch pure virtual function calls.
	// Because there is one _purecall_handler for the whole process,
	// calling this function immediately impacts all threads. The last
	// caller on any thread sets the handler.
	// http://msdn.microsoft.com/en-us/library/t296ys27.aspx
	m_pPreviousCrashHandlers->m_pureCallHandler = _set_purecall_handler(PureCallHandler);
	
	// Catch new operator memory allocation exceptions.
	_set_new_mode(1); // Force malloc() to call new handler too
	m_pPreviousCrashHandlers->m_newHandler = _set_new_handler(NewHandler);
	
	// Catch invalid parameter exceptions.
	m_pPreviousCrashHandlers->m_invalidParameterHandler
		= _set_invalid_parameter_handler(InvalidParameterHandler);
	
	// Catch an abnormal program termination.
	_set_abort_behavior(_CALL_REPORTFAULT, _CALL_REPORTFAULT);
	m_pPreviousCrashHandlers->m_SIGABRTHandler = signal(SIGABRT, SignalHandler);
	
	// Catch illegal instruction handler.
	m_pPreviousCrashHandlers->m_SIGINTHandler = signal(SIGINT, SignalHandler);
	
	// Catch a termination request.
	m_pPreviousCrashHandlers->m_SIGTERMHandler = signal(SIGTERM, SignalHandler);
	
	// We must also register the main thread crash handlers.
	return registerThreadCrashHandlers();
}