server: Don't change the reported machine for COM+ images.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50826
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-03-19 22:01:42 +01:00
parent 74390cead3
commit cc9446f874
3 changed files with 18 additions and 13 deletions

View File

@ -452,14 +452,20 @@ static NTSTATUS loader_exec( const char *loader, char **argv, WORD machine )
*/
NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_info )
{
int is_child_64bit = (pe_info->machine == IMAGE_FILE_MACHINE_AMD64 ||
pe_info->machine == IMAGE_FILE_MACHINE_ARM64);
WORD machine = pe_info->machine;
int is_child_64bit = (machine == IMAGE_FILE_MACHINE_AMD64 || machine == IMAGE_FILE_MACHINE_ARM64);
ULONGLONG res_start = pe_info->base;
ULONGLONG res_end = pe_info->base + pe_info->map_size;
const char *loader = argv0;
const char *loader_env = getenv( "WINELOADER" );
char preloader_reserve[64], socket_env[64];
if (!is_child_64bit && (is_win64 || is_wow64) && (pe_info->image_flags & IMAGE_FLAGS_ComPlusNativeReady))
{
is_child_64bit = TRUE;
machine = IMAGE_FILE_MACHINE_AMD64;
}
if (!is_win64 ^ !is_child_64bit)
{
/* remap WINELOADER to the alternate 32/64-bit version if necessary */
@ -495,7 +501,7 @@ NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_i
putenv( preloader_reserve );
putenv( socket_env );
return loader_exec( loader, argv, pe_info->machine );
return loader_exec( loader, argv, machine );
}

View File

@ -80,11 +80,14 @@ static const char * const cpu_names[] = { "x86", "x86_64", "PowerPC", "ARM", "AR
static UINT process_error_mode;
static client_cpu_t get_machine_cpu( WORD machine )
static client_cpu_t get_machine_cpu( pe_image_info_t *pe_info )
{
switch (machine)
switch (pe_info->machine)
{
case IMAGE_FILE_MACHINE_I386: return CPU_x86;
case IMAGE_FILE_MACHINE_I386:
if ((is_win64 || is_wow64) && (pe_info->image_flags & IMAGE_FLAGS_ComPlusNativeReady))
return CPU_x86_64;
return CPU_x86;
case IMAGE_FILE_MACHINE_AMD64: return CPU_x86_64;
case IMAGE_FILE_MACHINE_ARMNT: return CPU_ARM;
case IMAGE_FILE_MACHINE_ARM64: return CPU_ARM64;
@ -679,7 +682,7 @@ void DECLSPEC_NORETURN exec_process( NTSTATUS status )
SERVER_START_REQ( exec_process )
{
req->socket_fd = socketfd[1];
req->cpu = get_machine_cpu( pe_info.machine );
req->cpu = get_machine_cpu( &pe_info );
status = wine_server_call( req );
}
SERVER_END_REQ;
@ -963,7 +966,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
req->create_flags = params->DebugFlags; /* hack: creation flags stored in DebugFlags for now */
req->socket_fd = socketfd[1];
req->access = process_access;
req->cpu = get_machine_cpu( pe_info.machine );
req->cpu = get_machine_cpu( &pe_info );
req->info_size = startup_info_size;
req->handles_size = handles_size;
wine_server_add_data( req, objattr, attr_len );
@ -990,7 +993,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
break;
case STATUS_INVALID_IMAGE_FORMAT:
ERR( "%s not supported on this installation (%s binary)\n",
debugstr_us(&path), cpu_names[get_machine_cpu(pe_info.machine)] );
debugstr_us(&path), cpu_names[get_machine_cpu(&pe_info)] );
break;
}
goto done;

View File

@ -788,11 +788,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
if (nt.opt.hdr32.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
{
if (!(clr.Flags & COMIMAGE_FLAGS_32BITREQUIRED))
{
mapping->image.image_flags |= IMAGE_FLAGS_ComPlusNativeReady;
if (cpu_mask & CPU_FLAG(CPU_x86_64)) mapping->image.machine = IMAGE_FILE_MACHINE_AMD64;
else if (cpu_mask & CPU_FLAG(CPU_ARM64)) mapping->image.machine = IMAGE_FILE_MACHINE_ARM64;
}
if (clr.Flags & COMIMAGE_FLAGS_32BITPREFERRED)
mapping->image.image_flags |= IMAGE_FLAGS_ComPlusPrefer32bit;
}