AddVectoredExceptionHandler function
Applies to: desktop apps only
Registers a vectored exception handler.
Syntax
PVOID WINAPI AddVectoredExceptionHandler( __in ULONG FirstHandler, __in PVECTORED_EXCEPTION_HANDLER VectoredHandler );
Parameters
- FirstHandler [in]
-
The order in which the handler should be called. If the parameter is nonzero, the handler is the first handler to be called. If the parameter is zero, the handler is the last handler to be called.
- VectoredHandler [in]
-
A pointer to the handler to be called. For more information, see VectoredHandler.
Return value
If the function succeeds, the return value is a handle to the exception handler.
If the function fails, the return value is NULL.
Remarks
If the FirstHandler parameter is nonzero, the handler is the first handler to be called until a subsequent call to AddVectoredExceptionHandler is used to specify a different handler as the first handler.
If the VectoredHandler parameter points to a function in a DLL and that DLL is unloaded, the handler is still registered. This can lead to application errors.
To unregister the handler, use the RemoveVectoredExceptionHandler function.
To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0500 or later. For more information, see Using the Windows Headers.
Examples
For an example, see Using a Vectored Exception Handler.
Requirements
|
Minimum supported client | Windows XP |
|---|---|
|
Minimum supported server | Windows Server 2003 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- AddVectoredContinueHandler
- RemoveVectoredExceptionHandler
- VectoredHandler
- Vectored Exception Handling
Send comments about this topic to Microsoft
Build date: 3/6/2012
- 6/15/2007
- Myria
If you install a VectoredExceptionHandler (VEH), make sure that it never runs managed code. (This is similar to the restriction that you can't run managed code in DllMain). The VEH is for native SEH exceptions, and not managed exceptions. Do not use the VEH to interfere with managed exception processing.
See http://blogs.msdn.com/jmstall/archive/2006/05/24/avoid-vectored-exception-handler-managed-code.aspx for more details.
There's a discussion about this on the forums at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1495891&SiteID=1.
- 4/25/2007
- Mike Stall - MSFT