What exactly is "application-defined" about UnhandledExceptionFilter?

520 views Asked by At

MSDN describes UnhandledExceptionFilter as follows: "An application-defined function that passes unhandled exceptions to the debugger, if the process is being debugged."

But this function is clearly supplied by the OS, in kernel32.dll according to that same page.

So why do they call it an application-defined function?

2

There are 2 answers

1
Hans Passant On BEST ANSWER

Yes, very awkward language. It is a prototype definition of a function. Which you can use with the __except keyword or as an argument to SetUnhandledExceptionFilter(). Either would make yours an 'application defined function'.

There's default handling if you do neither, the debugger automatically stops at an unhandled exception. Which I suppose is what they meant with "that passes exceptions to the debugger". The SDK docs for SEH deserve an all-around failing grade.

2
Remy Lebeau On

UnhandledExceptionFilter() itself is not a function of its own provided by the kernel (although the kernel does implement its own default implementation that is used until you override it with your own). The UnhandledExceptionFilter() documentation you quote describes a function prototype that you have to follow if you choose to implement your own function and pass it to the SetUnhandledExceptionFilter() function to activate it within the kernel.