Commit d007c91d authored by Martin Storsjö's avatar Martin Storsjö Committed by Alexandre Julliard

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: 's avatarMartin Storsjö <martin@martin.st>
parent 2d43653a
...@@ -133,6 +133,7 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX ...@@ -133,6 +133,7 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX
{ {
LDR_DATA_TABLE_ENTRY *module; LDR_DATA_TABLE_ENTRY *module;
NTSTATUS status; NTSTATUS status;
DWORD pc;
dispatch->ImageBase = 0; dispatch->ImageBase = 0;
dispatch->ScopeIndex = 0; dispatch->ScopeIndex = 0;
...@@ -143,14 +144,14 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX ...@@ -143,14 +144,14 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX
* signal frame. * signal frame.
*/ */
dispatch->ControlPcIsUnwound = (context->ContextFlags & CONTEXT_UNWOUND_TO_CALL) != 0; dispatch->ControlPcIsUnwound = (context->ContextFlags & CONTEXT_UNWOUND_TO_CALL) != 0;
pc = context->Pc - (dispatch->ControlPcIsUnwound ? 2 : 0);
/* first look for PE exception information */ /* first look for PE exception information */
if ((dispatch->FunctionEntry = lookup_function_info( if ((dispatch->FunctionEntry = lookup_function_info(pc,
context->Pc - (dispatch->ControlPcIsUnwound ? 2 : 0),
(ULONG_PTR*)&dispatch->ImageBase, &module ))) (ULONG_PTR*)&dispatch->ImageBase, &module )))
{ {
dispatch->LanguageHandler = RtlVirtualUnwind( type, dispatch->ImageBase, context->Pc, dispatch->LanguageHandler = RtlVirtualUnwind( type, dispatch->ImageBase, pc,
dispatch->FunctionEntry, context, dispatch->FunctionEntry, context,
&dispatch->HandlerData, (ULONG_PTR *)&dispatch->EstablisherFrame, &dispatch->HandlerData, (ULONG_PTR *)&dispatch->EstablisherFrame,
NULL ); NULL );
......
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