★初心者にVisual C++ ..
94:デフォルトの名無しさん
07/01/11 22:55:38
>7にはこのコードをあげる。よい子は使っちゃダメだぞ。
typedef void (*throwFuncType)();
void dothrow_func(){ throw 300;}
DWORD CALLBACK threadproc( void * ){
printf("BeginThread\n");
int i=0;
try{
while(1) { i++; }
}catch( int ){
printf("\n%d: catched exception.\n",i);
}
return 0;
}
int main(){
throwFuncType dothrow_ptr = dothrow_func;
DWORD id; HANDLE hThread = CreateThread(NULL,0,threadproc,NULL,0,&id);
char t[255]; fgets(t,200,stdin);
CONTEXT context; context.ContextFlags = CONTEXT_CONTROL;
SuspendThread( hThread); GetThreadContext(hThread, &context);
context.Eip = (DWORD)dothrow_ptr;
SetThreadContext(hThread, &context); ResumeThread( hThread);
WaitForSingleObject(hThread,INFINITE);
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
4339日前に更新/201 KB
担当:undef