// Initializes the Unix crash handler. void initBlackMagic() { #ifdef Q_OS_UNIX // Register the handler. signal(SIGSEGV, handler); signal(SIGABRT, handler); #elif defined Q_OS_WIN32 // I hate Windows SetUnhandledExceptionFilter(ExceptionFilter); #endif #ifdef TEST_SEGV testCrash(); #endif }
void HelicopterTest::run() { testEndEpisode(); testCrash(); }
int __cdecl main() { printf("main application routine entering..\n"); bool b = false; while(b) { int i = 0; } int *p = NULL; int xx = 0; xx = testCrash(5,10,15); printf("main application routine exiting..= %x\n", xx); HANDLE hFile = CreateFileW( L"c:\\test.txt", GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile) { WriteFile(hFile, "Test", 5, NULL, NULL); CloseHandle(hFile); } else { printf("Failed to open file.\n"); } printf("Unicode CreateFile Done\n"); hFile = CreateFileA( "c:\\test.txt", GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); printf("Ansi CreateFile Called\n"); if (hFile) { printf("Calling CloseHandle\n"); CloseHandle(hFile); printf("Called CloseHandle\n"); } printf("All CreateFile Done\n"); printf("PASSED!\n"); fflush(stdin); printf("Enter a key to exit.\n"); scanf("%d", &xx); getchar(); return 0; }