ntdll: Remove no longer accessible TEB frames in RtlRestoreContext.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2016-08-18 17:43:36 +02:00 committed by Alexandre Julliard
parent b13924a6c9
commit b4991f20cb
1 changed files with 10 additions and 0 deletions

View File

@ -3557,6 +3557,8 @@ __ASM_GLOBAL_FUNC( call_consolidate_callback,
*/ */
void WINAPI RtlRestoreContext( CONTEXT *context, EXCEPTION_RECORD *rec ) void WINAPI RtlRestoreContext( CONTEXT *context, EXCEPTION_RECORD *rec )
{ {
EXCEPTION_REGISTRATION_RECORD *teb_frame = NtCurrentTeb()->Tib.ExceptionList;
if (rec && rec->ExceptionCode == STATUS_LONGJUMP && rec->NumberParameters >= 1) if (rec && rec->ExceptionCode == STATUS_LONGJUMP && rec->NumberParameters >= 1)
{ {
struct MSVCRT_JUMP_BUFFER *jmp = (struct MSVCRT_JUMP_BUFFER *)rec->ExceptionInformation[0]; struct MSVCRT_JUMP_BUFFER *jmp = (struct MSVCRT_JUMP_BUFFER *)rec->ExceptionInformation[0];
@ -3586,6 +3588,14 @@ void WINAPI RtlRestoreContext( CONTEXT *context, EXCEPTION_RECORD *rec )
TRACE( "calling consolidate callback %p (rec=%p)\n", consolidate, rec ); TRACE( "calling consolidate callback %p (rec=%p)\n", consolidate, rec );
context->Rip = (ULONG64)call_consolidate_callback( context, consolidate, rec ); context->Rip = (ULONG64)call_consolidate_callback( context, consolidate, rec );
} }
/* hack: remove no longer accessible TEB frames */
while ((ULONG64)teb_frame < context->Rsp)
{
TRACE( "removing TEB frame: %p\n", teb_frame );
teb_frame = __wine_pop_frame( teb_frame );
}
TRACE( "returning to %lx stack %lx\n", context->Rip, context->Rsp ); TRACE( "returning to %lx stack %lx\n", context->Rip, context->Rsp );
set_cpu_context( context ); set_cpu_context( context );
} }