ntdll: Call __finally blocks in __C_specific_handler.

Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Daniel Lehman 2016-08-02 23:52:12 -07:00 committed by Alexandre Julliard
parent 4b11bd8083
commit 0b6e5fae74
1 changed files with 26 additions and 1 deletions

View File

@ -81,6 +81,7 @@ typedef EXCEPTION_DISPOSITION (WINAPI *PEXCEPTION_ROUTINE)( EXCEPTION_RECORD *re
ULONG64 frame,
CONTEXT *context,
struct _DISPATCHER_CONTEXT *dispatch );
typedef void (WINAPI *TERMINATION_HANDLER)( ULONG flags, ULONG64 frame );
typedef struct _DISPATCHER_CONTEXT
{
@ -3733,8 +3734,32 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
TRACE( "%p %lx %p %p\n", rec, frame, context, dispatch );
if (TRACE_ON(seh)) dump_scope_table( dispatch->ImageBase, table );
if (rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)) /* FIXME */
if (rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND))
{
for (i = 0; i < table->Count; i++)
{
if (context->Rip >= dispatch->ImageBase + table->ScopeRecord[i].BeginAddress &&
context->Rip < dispatch->ImageBase + table->ScopeRecord[i].EndAddress)
{
TERMINATION_HANDLER handler;
if (table->ScopeRecord[i].JumpTarget) continue;
if (rec->ExceptionFlags & EH_TARGET_UNWIND &&
dispatch->TargetIp >= dispatch->ImageBase + table->ScopeRecord[i].BeginAddress &&
dispatch->TargetIp < dispatch->ImageBase + table->ScopeRecord[i].EndAddress)
{
break;
}
handler = (TERMINATION_HANDLER)(dispatch->ImageBase + table->ScopeRecord[i].HandlerAddress);
TRACE( "calling __finally %p frame %lx\n", handler, frame );
handler( 1, frame );
}
}
return ExceptionContinueSearch;
}
for (i = 0; i < table->Count; i++)
{