views:

25

answers:

2

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?

+1  A: 

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.

Hans Passant
OK, the way I understand it, this article manages to document a _prototype_ named UnhandledExceptionHandler, as well as a _function_ named UnhandledExceptionHandler, in one single place, utterly failing to explain the distinction. Thank you for clearing this up.
romkyns
+1  A: 

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.

Remy Lebeau - TeamB
Hmm, the way you say it seems equally misleading. If it's not a function of its own, how come it's showing up in my WinDbg stacktrace as `KERNEL32!UnhandledExceptionFilter`?
romkyns
(But that's a rhetoric question, really: I think I understand it now.)
romkyns