Commit 014f020e authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Share the nested exception handler across platforms.

parent 6ba584d1
......@@ -231,6 +231,17 @@ NTSTATUS WINAPI dispatch_user_callback( void *args, ULONG len, ULONG id )
#endif
/*******************************************************************
* nested_exception_handler
*/
EXCEPTION_DISPOSITION WINAPI nested_exception_handler( EXCEPTION_RECORD *rec, void *frame,
CONTEXT *context, void *dispatch )
{
if (rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)) return ExceptionContinueSearch;
return ExceptionNestedException;
}
/*******************************************************************
* raise_status
*
* Implementation of RtlRaiseStatus with a specific exception record.
......
......@@ -52,6 +52,8 @@ extern LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context );
extern NTSTATUS WINAPI dispatch_user_callback( void *args, ULONG len, ULONG id );
extern EXCEPTION_DISPOSITION WINAPI user_callback_handler( EXCEPTION_RECORD *record, void *frame,
CONTEXT *context, void *dispatch );
extern EXCEPTION_DISPOSITION WINAPI nested_exception_handler( EXCEPTION_RECORD *rec, void *frame,
CONTEXT *context, void *dispatch );
extern void DECLSPEC_NORETURN raise_status( NTSTATUS status, EXCEPTION_RECORD *rec );
extern LONG WINAPI call_unhandled_exception_filter( PEXCEPTION_POINTERS eptr );
extern void WINAPI process_breakpoint(void);
......
......@@ -304,28 +304,17 @@ static DWORD call_teb_unwind_handler( EXCEPTION_RECORD *rec, DISPATCHER_CONTEXT
}
static DWORD __cdecl nested_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher )
{
if (!(rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)))
rec->ExceptionFlags |= EH_NESTED_CALL;
return ExceptionContinueSearch;
}
/**********************************************************************
* call_handler
*
* Call a single exception handler.
* FIXME: Handle nested exceptions.
*/
static DWORD call_handler( EXCEPTION_RECORD *rec, CONTEXT *context, DISPATCHER_CONTEXT *dispatch )
{
EXCEPTION_REGISTRATION_RECORD frame;
DWORD res;
frame.Handler = nested_exception_handler;
frame.Handler = (PEXCEPTION_HANDLER)nested_exception_handler;
__wine_push_frame( &frame );
TRACE( "calling handler %p (rec=%p, frame=0x%lx context=%p, dispatch=%p)\n",
......@@ -404,7 +393,8 @@ static NTSTATUS call_function_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_con
case ExceptionContinueSearch:
break;
case ExceptionNestedException:
FIXME( "nested exception\n" );
rec->ExceptionFlags |= EH_NESTED_CALL;
TRACE_(seh)( "nested exception\n" );
break;
case ExceptionCollidedUnwind: {
ULONG_PTR frame;
......@@ -434,7 +424,8 @@ static NTSTATUS call_function_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_con
case ExceptionContinueSearch:
break;
case ExceptionNestedException:
FIXME( "nested exception\n" );
rec->ExceptionFlags |= EH_NESTED_CALL;
TRACE_(seh)( "nested exception\n" );
break;
case ExceptionCollidedUnwind: {
ULONG_PTR frame;
......
......@@ -335,28 +335,17 @@ static DWORD call_teb_unwind_handler( EXCEPTION_RECORD *rec, DISPATCHER_CONTEXT
}
static DWORD __cdecl nested_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher )
{
if (!(rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)))
rec->ExceptionFlags |= EH_NESTED_CALL;
return ExceptionContinueSearch;
}
/**********************************************************************
* call_handler
*
* Call a single exception handler.
* FIXME: Handle nested exceptions.
*/
static DWORD call_handler( EXCEPTION_RECORD *rec, CONTEXT *context, DISPATCHER_CONTEXT *dispatch )
{
EXCEPTION_REGISTRATION_RECORD frame;
DWORD res;
frame.Handler = nested_exception_handler;
frame.Handler = (PEXCEPTION_HANDLER)nested_exception_handler;
__wine_push_frame( &frame );
TRACE( "calling handler %p (rec=%p, frame=%I64x context=%p, dispatch=%p)\n",
......@@ -435,7 +424,8 @@ static NTSTATUS call_function_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_con
case ExceptionContinueSearch:
break;
case ExceptionNestedException:
FIXME( "nested exception\n" );
rec->ExceptionFlags |= EH_NESTED_CALL;
TRACE_(seh)( "nested exception\n" );
break;
case ExceptionCollidedUnwind: {
ULONG64 frame;
......@@ -465,7 +455,8 @@ static NTSTATUS call_function_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_con
case ExceptionContinueSearch:
break;
case ExceptionNestedException:
FIXME( "nested exception\n" );
rec->ExceptionFlags |= EH_NESTED_CALL;
TRACE_(seh)( "nested exception\n" );
break;
case ExceptionCollidedUnwind: {
ULONG64 frame;
......
......@@ -357,15 +357,6 @@ __ASM_GLOBAL_FUNC( RtlCaptureContext,
"fxsave 0x100(%rcx)\n\t" /* context->FltSave */
"ret" );
DWORD __cdecl nested_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher )
{
if (!(rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)))
return ExceptionNestedException;
return ExceptionContinueSearch;
}
/***********************************************************************
* exception_handler_call_wrapper
*/
......@@ -391,7 +382,7 @@ static DWORD exception_handler_call_wrapper( EXCEPTION_RECORD *rec, void *frame,
EXCEPTION_REGISTRATION_RECORD wrapper_frame;
DWORD res;
wrapper_frame.Handler = nested_exception_handler;
wrapper_frame.Handler = (PEXCEPTION_HANDLER)nested_exception_handler;
__wine_push_frame( &wrapper_frame );
res = dispatch->LanguageHandler( rec, (void *)dispatch->EstablisherFrame, context, dispatch );
__wine_pop_frame( &wrapper_frame );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment