Don't try to initialize the 16-bit thunking code if 16-bit support is

disabled.
This commit is contained in:
Alexandre Julliard 2005-08-27 10:18:03 +00:00
parent e18952a921
commit 6c6a5729d9
5 changed files with 38 additions and 34 deletions

View File

@ -879,6 +879,28 @@ DWORD INSTR_EmulateInstruction( EXCEPTION_RECORD *rec, CONTEXT86 *context )
}
/***********************************************************************
* INSTR_vectored_handler
*
* Vectored exception handler used to emulate protected instructions
* from 32-bit code.
*/
LONG CALLBACK INSTR_vectored_handler( EXCEPTION_POINTERS *ptrs )
{
EXCEPTION_RECORD *record = ptrs->ExceptionRecord;
CONTEXT *context = ptrs->ContextRecord;
if (wine_ldt_is_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;
}
/***********************************************************************
* INSTR_CallBuiltinHandler
*/

View File

@ -227,6 +227,8 @@ extern HTASK16 TASK_GetTaskFromThread( DWORD thread );
extern TDB *TASK_GetCurrent(void);
extern void TASK_InstallTHHook( THHOOK *pNewThook );
extern BOOL WOWTHUNK_Init(void);
extern DWORD CallTo16_DataSelector;
extern DWORD CallTo16_TebSelector;
extern SEGPTR CALL32_CBClient_RetAddr;

View File

@ -121,12 +121,6 @@ static BOOL process_attach(void)
/* Setup registry locale information */
LOCALE_InitRegistry();
/* Initialize 16-bit thunking entry points */
if (!WOWTHUNK_Init()) return FALSE;
/* Initialize DOS memory */
if (!DOSMEM_Init()) return FALSE;
/* Setup computer name */
COMPUTERNAME_Init();
@ -135,6 +129,12 @@ static BOOL process_attach(void)
if ((hModule = LoadLibrary16( "krnl386.exe" )) >= 32)
{
/* Initialize 16-bit thunking entry points */
if (!WOWTHUNK_Init()) return FALSE;
/* Initialize DOS memory */
if (!DOSMEM_Init()) return FALSE;
/* Initialize special KERNEL entry points */
/* Initialize KERNEL.178 (__WINFLAGS) with the correct flags value */
@ -170,8 +170,13 @@ static BOOL process_attach(void)
}
#ifdef __i386__
/* Create the shared heap for broken win95 native dlls */
if (GetVersion() & 0x80000000) HeapCreate( HEAP_SHARED, 0, 0 );
if (GetVersion() & 0x80000000)
{
/* create the shared heap for broken win95 native dlls */
HeapCreate( HEAP_SHARED, 0, 0 );
/* setup emulation of protected instructions from 32-bit code */
RtlAddVectoredExceptionHandler( TRUE, INSTR_vectored_handler );
}
#endif
/* initialize LDT locking */

View File

@ -72,7 +72,6 @@ extern const WCHAR *DIR_Windows;
extern const WCHAR *DIR_System;
extern void PTHREAD_Init(void);
extern BOOL WOWTHUNK_Init(void);
extern VOID SYSLEVEL_CheckNotLevel( INT level );
@ -81,6 +80,7 @@ extern WCHAR *FILE_name_AtoW( LPCSTR name, BOOL alloc );
extern DWORD FILE_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen );
extern DWORD INSTR_EmulateInstruction( EXCEPTION_RECORD *rec, CONTEXT86 *context );
extern LONG CALLBACK INSTR_vectored_handler( EXCEPTION_POINTERS *ptrs );
extern void INSTR_CallBuiltinHandler( CONTEXT86 *context, BYTE intnum );
/* return values for MODULE_GetBinaryType */

View File

@ -87,7 +87,6 @@ extern BYTE __wine_call16_end[];
extern void RELAY16_InitDebugLists(void);
static LONG CALLBACK vectored_handler( EXCEPTION_POINTERS *ptrs );
static SEGPTR call16_ret_addr; /* segptr to __wine_call_to_16_ret routine */
static WORD dpmi_checker_selector;
@ -127,8 +126,6 @@ BOOL WOWTHUNK_Init(void)
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;
}
@ -334,28 +331,6 @@ 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 (wine_ldt_is_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)