server: Add a native_machine global variable.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-06-23 11:32:40 +02:00
parent a7f39e3fbb
commit 2ff7a7676c
5 changed files with 7 additions and 4 deletions

View File

@ -134,7 +134,7 @@ static const struct object_ops debug_obj_ops =
/* get a pointer to TEB->ArbitraryUserPointer in the client address space */
static client_ptr_t get_teb_user_ptr( struct thread *thread )
{
unsigned int ptr_size = is_machine_64bit( supported_machines[0] ) ? 8 : 4;
unsigned int ptr_size = is_machine_64bit( native_machine ) ? 8 : 4;
return thread->teb + 5 * ptr_size;
}

View File

@ -717,7 +717,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
break;
case IMAGE_NT_OPTIONAL_HDR64_MAGIC:
if (!is_machine_64bit( supported_machines[0] )) return STATUS_INVALID_IMAGE_WIN_64;
if (!is_machine_64bit( native_machine )) return STATUS_INVALID_IMAGE_WIN_64;
if (!is_machine_64bit( nt.FileHeader.Machine )) return STATUS_INVALID_IMAGE_FORMAT;
if (!is_machine_supported( nt.FileHeader.Machine )) return STATUS_INVALID_IMAGE_FORMAT;

View File

@ -240,6 +240,7 @@ extern void generate_startup_debug_events( struct process *process );
extern unsigned int supported_machines_count;
extern unsigned short supported_machines[8];
extern unsigned short native_machine;
extern void init_registry(void);
extern void flush_registry(void);

View File

@ -1088,7 +1088,7 @@ int set_process_debug_flag( struct process *process, int flag )
char data = (flag != 0);
client_ptr_t peb32 = 0;
if (!is_machine_64bit( process->machine ) && is_machine_64bit( supported_machines[0] ))
if (!is_machine_64bit( process->machine ) && is_machine_64bit( native_machine ))
peb32 = process->peb + 0x1000;
/* BeingDebugged flag is the byte at offset 2 in the PEB */

View File

@ -147,6 +147,7 @@ static struct save_branch_info save_branch_info[MAX_SAVE_BRANCH_INFO];
unsigned int supported_machines_count = 0;
unsigned short supported_machines[8];
unsigned short native_machine = 0;
/* information about a file being loaded */
struct file_load_info
@ -1790,6 +1791,7 @@ static void init_supported_machines(void)
#error Unsupported machine
#endif
supported_machines_count = count;
native_machine = supported_machines[0];
}
/* registry initialisation */
@ -2071,7 +2073,7 @@ void flush_registry(void)
/* determine if the thread is wow64 (32-bit client running on 64-bit prefix) */
static int is_wow64_thread( struct thread *thread )
{
return (is_machine_64bit( supported_machines[0] ) && !is_machine_64bit( thread->process->machine ));
return (is_machine_64bit( native_machine ) && !is_machine_64bit( thread->process->machine ));
}