Showing posts with label vectored exception handling. Show all posts
Showing posts with label vectored exception handling. Show all posts

Monday, March 23, 2009

Vectored Exception Handling

Vectored exception handling provides a generic mechanism so that the developer does not have to rely on language-dependant keywords for exception handling. Windows provides the following APIs to use VEH:

  1. AddVectoredExceptionHandler
  2. RemoveVectoredExceptionHandler
  3. AddVectoredContinueHandler
  4. RemoveVectoredContinueHandler

All the VEH are called before the structured exception handlers (SEH). A programmer can choose to be first in the chain or the last in the chain of VEH while calling AddVectoredExceptionHandler. The Exception handlers can return EXCEPTION_CONTINUE_EXECUTION or EXCEPTION_CONTINUE_SEARCH depending on whether they have fixed the problem or not. The VEH mechanism also allows the programmer to add a ContinueHandler which is called in case of unhandled exceptions. The continuehandler is called after the global unhandled exception filter returns EXCEPTION_CONTINUE_SEARCH.

A VEH example can be seen in the MSDN. For more details on VEH, check http://msdn.microsoft.com/en-us/magazine/cc301714.aspx