Commit 59022e58 authored by Alexandre Julliard's avatar Alexandre Julliard

Restored emulation of protected instructions in 32-bit code when

running with a Win9x version.
parent 36746279
......@@ -688,6 +688,7 @@ DWORD INSTR_EmulateInstruction( EXCEPTION_RECORD *rec, CONTEXT86 *context )
break; /* Unable to emulate it */
case 0xcd: /* int <XX> */
if (IS_SELECTOR_SYSTEM(context->SegCs)) break; /* don't emulate it in 32-bit code */
if (!Dosvm.EmulateInterruptPM && !DPMI_LoadDosSystem())
{
ERR("could not initialize interrupt handling\n");
......@@ -701,6 +702,7 @@ DWORD INSTR_EmulateInstruction( EXCEPTION_RECORD *rec, CONTEXT86 *context )
break; /* Unable to emulate it */
case 0xcf: /* iret */
if (IS_SELECTOR_SYSTEM(context->SegCs)) break; /* don't emulate it in 32-bit code */
if (long_op)
{
DWORD *stack = get_stack( context );
......
......@@ -91,6 +91,7 @@ extern BYTE Call16_End;
extern void RELAY16_InitDebugLists(void);
static LONG CALLBACK vectored_handler( EXCEPTION_POINTERS *ptrs );
static SEGPTR call16_ret_addr; /* segptr to CallTo16_Ret routine */
/***********************************************************************
......@@ -114,6 +115,9 @@ BOOL WOWTHUNK_Init(void)
MAKESEGPTR( codesel, (char*)CALL32_CBClientEx_Ret - (char*)Call16_Ret_Start );
if (TRACE_ON(relay) || TRACE_ON(snoop)) RELAY16_InitDebugLists();
/* setup emulation of protected instructions from 32-bit code (only for Win9x versions) */
if (GetVersion() & 0x80000000) RtlAddVectoredExceptionHandler( TRUE, vectored_handler );
return TRUE;
}
......@@ -233,6 +237,28 @@ static DWORD vm86_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RECO
}
/***********************************************************************
* vectored_handler
*
* Vectored exception handler used to emulate protected instructions
* from 32-bit code.
*/
static LONG CALLBACK vectored_handler( EXCEPTION_POINTERS *ptrs )
{
EXCEPTION_RECORD *record = ptrs->ExceptionRecord;
CONTEXT *context = ptrs->ContextRecord;
if (IS_SELECTOR_SYSTEM(context->SegCs) &&
(record->ExceptionCode == EXCEPTION_ACCESS_VIOLATION ||
record->ExceptionCode == EXCEPTION_PRIV_INSTRUCTION))
{
if (INSTR_EmulateInstruction( record, context ) == ExceptionContinueExecution)
return EXCEPTION_CONTINUE_EXECUTION;
}
return EXCEPTION_CONTINUE_SEARCH;
}
#else /* __i386__ */
BOOL WOWTHUNK_Init(void)
......
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