?? dynamitethread.cpp
字號:
//
// FILE: DynamiteThread.cpp
//
// Copyright (c) 1997 by Aaron Michael Cohen and Mike Woodring
//
/////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <stdio.h>
#include "DynamiteThread.h"
// Dynamite thread's just light a fuse, burn down, and
// then explode by causing an exception to occur.
//
unsigned CDynamiteThread::GuardedThreadHandlerProc( void )
{
printf(
"[tid 0x%08lx] Dynamite thread running now - lighting fuse...",
GetCurrentThreadId()
);
// Show the fuse burning down...
//
for( int i = 0; i < 5; i++ )
{
Sleep(1000);
printf(".");
}
printf("!!!\n");
// Boom!
//
*((PBYTE)0) = '!';
// Will never reach this point.
//
printf(
"[tid 0x%08lx] Dynamite thread exiting normally after explosion\n",
GetCurrentThreadId()
);
return(0);
}
// The virtual exception filter handler is overridden just to display
// the sequence of events.
//
int CDynamiteThread::ExceptionFilter( DWORD dwExceptionCode, LPEXCEPTION_POINTERS pEP )
{
printf(
"[tid 0x%08lx] Dynamite exception filter running, exception = 0x%x\n",
GetCurrentThreadId(),
dwExceptionCode
);
return CGuardedThreadHandler::ExceptionFilter(dwExceptionCode, pEP);
}
// The virtual termination handler is overridden just to display
// the sequence of events.
//
unsigned CDynamiteThread::TerminationHandler( DWORD dwExceptionCode )
{
printf(
"[tid 0x%08lx] Dynamite termination handler running, exception = 0x%x\n",
GetCurrentThreadId(),
dwExceptionCode
);
return CGuardedThreadHandler::TerminationHandler(dwExceptionCode);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -