Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <Windows.h>
- #define CALL_FIRST 1
- #define CALL_LAST 0
- LONG WINAPI MyVectoredHandler(struct _EXCEPTION_POINTERS *ExceptionInfo)
- {
- UNREFERENCED_PARAMETER(ExceptionInfo);
- printf("MyVectoredHandlern");
- return EXCEPTION_CONTINUE_SEARCH;
- }
- LONG WINAPI MyUnhandledExceptionFilter(_In_ struct _EXCEPTION_POINTERS *ExceptionInfo)
- {
- printf("SetUnhandledExceptionFiltern");
- return EXCEPTION_CONTINUE_SEARCH;
- }
- void f()
- {
- __try
- {
- char p[20] = "hello,world!";
- p[24] = '!';
- printf("%sn", p);
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- printf("f() exceptionn");
- }
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- AddVectoredExceptionHandler(CALL_FIRST, MyVectoredHandler);
- SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
- try{
- f();
- }
- catch (...){
- printf("catched f exceptionn");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement