验证异常处理调用顺序:VEH –> SEH –> VCH
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
LONG WINAPI vch(EXCEPTION_POINTERS* pExcept)
{
printf("vch\n");
return EXCEPTION_CONTINUE_SERCH;
}
LONG WINAPI veh(EXCEPTION_POINTERS* pExcept)
{
printf("veh\n");
return EXCEPTION_CONTINUE_SEARCH;
}
LONG WINAPI seh(EXCEPTION_POINTERS* pExcept)
{
printf("seh\n");
return EXCEPTION_CONTINUE_SEARCH;
}
LONG WINAPI ueh(EXCEPTION_POINTERS* pExcept)
{
printf("ueh\n");
return EXCEPTION_CONTINUE_SEARCH;
}
int _tmain(int argc, _TCHAR* argv[])
{
AddVectoredContinueHandler(TRUE, vch);
AddVectoreExceptionHandler(TRUE, veh);
//在64位系统系下,当程序被调用时,UEH不会被调用,不被调试才会被调用
//在32位系统下,被调试时也会被调用
SetUnhandledExceptionFilter(ueh);
__try{
*(int*)0=0;
}
__except(seh(GetExceptionInformation())){
}
return 0;
}