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
{
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 );
......
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