I am using the following MSVC++ console application code (running on Windows 8.1, Release, Win32) to try and return a top-level exception back to me:
#include "stdafx.h"
#include <Windows.h>
#include <iostream>
using namespace std;
LONG WINAPI UnhandledExceptionFilter(PEXCEPTION_POINTERS exception)
{
printf("Got an unhandled exception.");
return EXCEPTION_CONTINUE_SEARCH;
}
int _tmain(int argc, _TCHAR* argv[])
{
SetUnhandledExceptionFilter(UnhandledExceptionFilter);
int a = 0;
int b = 0;
int c = a / b;
cin.get();
return 0;
}
My UnhandledExceptionFilter
doesn't actually seem to ever get called on the divide by zero exception that is being thrown in this example, otherwise I would expect the "Got an unhandled exception" log message to show up. Why is that?