",

ExceptionRecord->ExceptionCode,

ExceptionRecord->ExceptionFlags);

if(ExceptionRecord->ExceptionCode == STATUS_INTEGER_DIVIDE_BY_ZERO)

{

ContexRecord->Ecx = 10;

return ExceptionContinueExecution;

}

return ExceptionContinueSearch;

}

int main(int argc, char* argv[])

{

__asm

{

// 手工方法將異常函數(shù)注冊到FS:[0]鏈表中

push OFFSET _raw_seh_handler

push FS:[0]

mov FS:[0], ESP

// 執(zhí)行除零異常

xor edx, edx

mov eax, 100

xor ecx, ecx

idiv ecx

mov eax, [ESP]

mov FS:[0], EAX

add esp, 8

}

printf("Hello World!
");

return 0;

}

分享到

wangyao

相關(guān)推薦