Module: wine Branch: master Commit: d007c91d46bb9868ccde0c32865c616b1f255827 URL: https://source.winehq.org/git/wine.git/?a=commit;h=d007c91d46bb9868ccde0c328...
Author: Martin Storsjö martin@martin.st Date: Tue Jun 7 14:10:07 2022 +0300
ntdll: Use ControlPcIsUnwound for the RtlVirtualUnwind pc parameter in virtual_unwind.
Don't just use ControlPcIsUnwound for picking which RUNTIME_FUNCTION to use, but also use it for adjusting the pc value that is passed to RtlVirtualUnwind.
This fixes one testcase (that I had missed to build and run before), where the pc points at the start of an epilogue (which would mean that no handler is returned from RtlVirtualUnwind). By taking ControlPcIsUnwound and adjusting the pc pointer, the unwind handler is returned and executed.
Signed-off-by: Martin Storsjö martin@martin.st
---
dlls/ntdll/signal_arm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c index 01c911660de..c4cf557edaf 100644 --- a/dlls/ntdll/signal_arm.c +++ b/dlls/ntdll/signal_arm.c @@ -133,6 +133,7 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX { LDR_DATA_TABLE_ENTRY *module; NTSTATUS status; + DWORD pc;
dispatch->ImageBase = 0; dispatch->ScopeIndex = 0; @@ -143,14 +144,14 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX * signal frame. */ dispatch->ControlPcIsUnwound = (context->ContextFlags & CONTEXT_UNWOUND_TO_CALL) != 0; + pc = context->Pc - (dispatch->ControlPcIsUnwound ? 2 : 0);
/* first look for PE exception information */
- if ((dispatch->FunctionEntry = lookup_function_info( - context->Pc - (dispatch->ControlPcIsUnwound ? 2 : 0), + if ((dispatch->FunctionEntry = lookup_function_info(pc, (ULONG_PTR*)&dispatch->ImageBase, &module ))) { - dispatch->LanguageHandler = RtlVirtualUnwind( type, dispatch->ImageBase, context->Pc, + dispatch->LanguageHandler = RtlVirtualUnwind( type, dispatch->ImageBase, pc, dispatch->FunctionEntry, context, &dispatch->HandlerData, (ULONG_PTR *)&dispatch->EstablisherFrame, NULL );