ntdll: Use RtlCaptureContext also in RtlUnwind.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2017-07-24 10:59:45 +02:00
parent 2bb668b1da
commit dc63fbf98d
5 changed files with 32 additions and 5 deletions

View File

@ -10,6 +10,6 @@
@ stdcall RtlPcToFileHeader(ptr ptr) ntdll.RtlPcToFileHeader
@ stdcall -norelay RtlRaiseException(ptr) ntdll.RtlRaiseException
@ stdcall -arch=x86_64 RtlRestoreContext(ptr ptr) ntdll.RtlRestoreContext
@ stdcall -register RtlUnwind(ptr ptr ptr ptr) ntdll.RtlUnwind
@ stdcall -norelay RtlUnwind(ptr ptr ptr ptr) ntdll.RtlUnwind
@ stdcall -arch=x86_64 RtlUnwindEx(ptr ptr ptr ptr ptr ptr) ntdll.RtlUnwindEx
@ stdcall -arch=x86_64 RtlVirtualUnwind(long long long ptr ptr ptr ptr ptr) ntdll.RtlVirtualUnwind

View File

@ -3,4 +3,4 @@
@ stdcall RtlCompareMemory(ptr ptr long) ntdll.RtlCompareMemory
@ stdcall RtlPcToFileHeader(ptr ptr) ntdll.RtlPcToFileHeader
@ stdcall -norelay RtlRaiseException(ptr) ntdll.RtlRaiseException
@ stdcall -register RtlUnwind(ptr ptr ptr ptr) ntdll.RtlUnwind
@ stdcall -norelay RtlUnwind(ptr ptr ptr ptr) ntdll.RtlUnwind

View File

@ -940,7 +940,7 @@
# @ stub RtlUnlockBootStatusData
@ stdcall RtlUnlockHeap(long)
# @ stub RtlUnlockMemoryStreamRegion
@ stdcall -register RtlUnwind(ptr ptr ptr ptr)
@ stdcall -norelay RtlUnwind(ptr ptr ptr ptr)
@ stdcall -arch=x86_64 RtlUnwindEx(ptr ptr ptr ptr ptr ptr)
@ stdcall RtlUpcaseUnicodeChar(long)
@ stdcall RtlUpcaseUnicodeString(ptr ptr long)

View File

@ -2667,6 +2667,11 @@ void WINAPI __regs_RtlUnwind( EXCEPTION_REGISTRATION_RECORD* pEndFrame, PVOID ta
pRecord->ExceptionFlags |= EH_UNWINDING | (pEndFrame ? 0 : EH_EXIT_UNWIND);
TRACE( "code=%x flags=%x\n", pRecord->ExceptionCode, pRecord->ExceptionFlags );
TRACE( "eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n",
context->Eax, context->Ebx, context->Ecx, context->Edx, context->Esi, context->Edi );
TRACE( "ebp=%08x esp=%08x eip=%08x cs=%04x ds=%04x fs=%04x gs=%04x flags=%08x\n",
context->Ebp, context->Esp, context->Eip, LOWORD(context->SegCs), LOWORD(context->SegDs),
LOWORD(context->SegFs), LOWORD(context->SegGs), context->EFlags );
/* get chain of exception frames */
frame = NtCurrentTeb()->Tib.ExceptionList;
@ -2697,8 +2702,30 @@ void WINAPI __regs_RtlUnwind( EXCEPTION_REGISTRATION_RECORD* pEndFrame, PVOID ta
}
frame = __wine_pop_frame( frame );
}
NtSetContextThread( GetCurrentThread(), context );
}
DEFINE_REGS_ENTRYPOINT( RtlUnwind, 4 )
__ASM_STDCALL_FUNC( RtlUnwind, 16,
"pushl %ebp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
__ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
"movl %esp,%ebp\n\t"
__ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
"leal -(0x2cc+8)(%esp),%esp\n\t" /* sizeof(CONTEXT) + alignment */
"pushl %esp\n\t" /* context */
"call " __ASM_NAME("RtlCaptureContext") __ASM_STDCALL(4) "\n\t"
"leal 24(%ebp),%eax\n\t"
"movl %eax,0xc4(%esp)\n\t" /* context->Esp */
"pushl %esp\n\t"
"pushl 20(%ebp)\n\t"
"pushl 16(%ebp)\n\t"
"pushl 12(%ebp)\n\t"
"pushl 8(%ebp)\n\t"
"call " __ASM_NAME("__regs_RtlUnwind") __ASM_STDCALL(20) "\n\t"
"leave\n\t"
__ASM_CFI(".cfi_def_cfa %esp,4\n\t")
__ASM_CFI(".cfi_same_value %ebp\n\t")
"ret $16" ) /* actually never returns */
/*******************************************************************

View File

@ -1185,7 +1185,7 @@
@ stdcall RtlUnicodeToMultiByteSize(ptr ptr long) ntdll.RtlUnicodeToMultiByteSize
@ stdcall RtlUnicodeToOemN(ptr long ptr ptr long) ntdll.RtlUnicodeToOemN
@ stub RtlUnlockBootStatusData
@ stdcall -register RtlUnwind(ptr ptr ptr ptr) ntdll.RtlUnwind
@ stdcall -norelay RtlUnwind(ptr ptr ptr ptr) ntdll.RtlUnwind
@ stdcall -arch=x86_64 RtlUnwindEx(ptr ptr ptr ptr ptr ptr) ntdll.RtlUnwindEx
@ stdcall RtlUpcaseUnicodeChar(long) ntdll.RtlUpcaseUnicodeChar
@ stdcall RtlUpcaseUnicodeString(ptr ptr long) ntdll.RtlUpcaseUnicodeString