wow64: Patch the Wow64Transition pointer in all loaded modules.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0afbbabcd9
commit
40673153b4
|
@ -334,6 +334,17 @@ static DWORD get_syscall_num( const BYTE *syscall )
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* init_image_mapping
|
||||
*/
|
||||
void init_image_mapping( HMODULE module )
|
||||
{
|
||||
void **ptr = RtlFindExportedRoutineByName( module, "Wow64Transition" );
|
||||
|
||||
if (ptr) *ptr = pBTCpuGetBopCode();
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* init_syscall_table
|
||||
*/
|
||||
|
@ -440,7 +451,6 @@ static HMODULE load_cpu_dll(void)
|
|||
*/
|
||||
static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **context )
|
||||
{
|
||||
void **pWow64Transition, **p__wine_syscall_dispatcher;
|
||||
HMODULE module;
|
||||
UNICODE_STRING str;
|
||||
|
||||
|
@ -454,18 +464,17 @@ static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **contex
|
|||
LdrGetDllHandle( NULL, 0, &str, &module );
|
||||
GET_PTR( LdrSystemDllInitBlock );
|
||||
|
||||
module = (HMODULE)(ULONG_PTR)pLdrSystemDllInitBlock->ntdll_handle;
|
||||
GET_PTR( Wow64Transition );
|
||||
GET_PTR( __wine_syscall_dispatcher );
|
||||
init_syscall_table( module, 0, &ntdll_syscall_table );
|
||||
|
||||
module = load_cpu_dll();
|
||||
GET_PTR( BTCpuGetBopCode );
|
||||
GET_PTR( BTCpuProcessInit );
|
||||
GET_PTR( BTCpuSimulate );
|
||||
|
||||
pBTCpuProcessInit();
|
||||
*pWow64Transition = *p__wine_syscall_dispatcher = pBTCpuGetBopCode();
|
||||
|
||||
module = (HMODULE)(ULONG_PTR)pLdrSystemDllInitBlock->ntdll_handle;
|
||||
init_image_mapping( module );
|
||||
init_syscall_table( module, 0, &ntdll_syscall_table );
|
||||
*(void **)RtlFindExportedRoutineByName( module, "__wine_syscall_dispatcher" ) = pBTCpuGetBopCode();
|
||||
|
||||
init_file_redirects();
|
||||
return TRUE;
|
||||
|
|
|
@ -257,6 +257,12 @@ NTSTATUS WINAPI wow64_NtMapViewOfSection( UINT *args )
|
|||
commit, offset, size_32to64( &size, size32 ), inherit, alloc, protect );
|
||||
if (NT_SUCCESS(status))
|
||||
{
|
||||
SECTION_IMAGE_INFORMATION info;
|
||||
|
||||
if (!NtQuerySection( handle, SectionImageInformation, &info, sizeof(info), NULL ))
|
||||
{
|
||||
if (info.Machine == current_machine) init_image_mapping( addr );
|
||||
}
|
||||
put_addr( addr32, addr );
|
||||
put_size( size32, size );
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ void * WINAPI Wow64AllocateTemp( SIZE_T size );
|
|||
void WINAPI Wow64ApcRoutine( ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3, CONTEXT *context );
|
||||
void WINAPI Wow64PassExceptionToGuest( EXCEPTION_POINTERS *ptrs );
|
||||
|
||||
extern void init_image_mapping( HMODULE module ) DECLSPEC_HIDDEN;
|
||||
extern void init_file_redirects(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL get_file_redirect( OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
Loading…
Reference in New Issue