ntdll: The loader is named wine64 only on platforms that support WoW64.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49438 Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e9951dbe37
commit
b64208df0d
|
@ -426,13 +426,13 @@ static void preloader_exec( char **argv )
|
||||||
execv( argv[1], argv + 1 );
|
execv( argv[1], argv + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS loader_exec( const char *loader, char **argv, int is_child_64bit )
|
static NTSTATUS loader_exec( const char *loader, char **argv, client_cpu_t cpu )
|
||||||
{
|
{
|
||||||
char *p, *path;
|
char *p, *path;
|
||||||
|
|
||||||
if (build_dir)
|
if (build_dir)
|
||||||
{
|
{
|
||||||
argv[1] = build_path( build_dir, is_child_64bit ? "loader/wine64" : "loader/wine" );
|
argv[1] = build_path( build_dir, (cpu == CPU_x86_64) ? "loader/wine64" : "loader/wine" );
|
||||||
preloader_exec( argv );
|
preloader_exec( argv );
|
||||||
return STATUS_INVALID_IMAGE_FORMAT;
|
return STATUS_INVALID_IMAGE_FORMAT;
|
||||||
}
|
}
|
||||||
|
@ -465,9 +465,11 @@ static NTSTATUS loader_exec( const char *loader, char **argv, int is_child_64bit
|
||||||
*
|
*
|
||||||
* argv[0] and argv[1] must be reserved for the preloader and loader respectively.
|
* argv[0] and argv[1] must be reserved for the preloader and loader respectively.
|
||||||
*/
|
*/
|
||||||
NTSTATUS exec_wineloader( char **argv, int socketfd, int is_child_64bit,
|
NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_info )
|
||||||
ULONGLONG res_start, ULONGLONG res_end )
|
|
||||||
{
|
{
|
||||||
|
int is_child_64bit = (pe_info->cpu == CPU_x86_64 || pe_info->cpu == CPU_ARM64);
|
||||||
|
ULONGLONG res_start = pe_info->base;
|
||||||
|
ULONGLONG res_end = pe_info->base + pe_info->map_size;
|
||||||
const char *loader = argv0;
|
const char *loader = argv0;
|
||||||
const char *loader_env = getenv( "WINELOADER" );
|
const char *loader_env = getenv( "WINELOADER" );
|
||||||
char preloader_reserve[64], socket_env[64];
|
char preloader_reserve[64], socket_env[64];
|
||||||
|
@ -507,7 +509,7 @@ NTSTATUS exec_wineloader( char **argv, int socketfd, int is_child_64bit,
|
||||||
putenv( preloader_reserve );
|
putenv( preloader_reserve );
|
||||||
putenv( socket_env );
|
putenv( socket_env );
|
||||||
|
|
||||||
return loader_exec( loader, argv, is_child_64bit );
|
return loader_exec( loader, argv, pe_info->cpu );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1805,7 +1807,7 @@ void __wine_main( int argc, char *argv[], char *envp[] )
|
||||||
{
|
{
|
||||||
char **new_argv = malloc( (argc + 2) * sizeof(*argv) );
|
char **new_argv = malloc( (argc + 2) * sizeof(*argv) );
|
||||||
memcpy( new_argv + 1, argv, (argc + 1) * sizeof(*argv) );
|
memcpy( new_argv + 1, argv, (argc + 1) * sizeof(*argv) );
|
||||||
loader_exec( argv0, new_argv, is_win64 );
|
loader_exec( argv0, new_argv, client_cpu );
|
||||||
fatal_error( "could not exec the wine loader\n" );
|
fatal_error( "could not exec the wine loader\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -523,7 +523,6 @@ static void set_stdio_fd( int stdin_fd, int stdout_fd )
|
||||||
static NTSTATUS spawn_process( const RTL_USER_PROCESS_PARAMETERS *params, int socketfd,
|
static NTSTATUS spawn_process( const RTL_USER_PROCESS_PARAMETERS *params, int socketfd,
|
||||||
int unixdir, char *winedebug, const pe_image_info_t *pe_info )
|
int unixdir, char *winedebug, const pe_image_info_t *pe_info )
|
||||||
{
|
{
|
||||||
const int is_child_64bit = (pe_info->cpu == CPU_x86_64 || pe_info->cpu == CPU_ARM64);
|
|
||||||
NTSTATUS status = STATUS_SUCCESS;
|
NTSTATUS status = STATUS_SUCCESS;
|
||||||
int stdin_fd = -1, stdout_fd = -1;
|
int stdin_fd = -1, stdout_fd = -1;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
@ -556,8 +555,7 @@ static NTSTATUS spawn_process( const RTL_USER_PROCESS_PARAMETERS *params, int so
|
||||||
}
|
}
|
||||||
argv = build_argv( ¶ms->CommandLine, 2 );
|
argv = build_argv( ¶ms->CommandLine, 2 );
|
||||||
|
|
||||||
exec_wineloader( argv, socketfd, is_child_64bit,
|
exec_wineloader( argv, socketfd, pe_info );
|
||||||
pe_info->base, pe_info->base + pe_info->map_size );
|
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,7 +584,6 @@ static NTSTATUS spawn_process( const RTL_USER_PROCESS_PARAMETERS *params, int so
|
||||||
NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status )
|
NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status )
|
||||||
{
|
{
|
||||||
pe_image_info_t pe_info;
|
pe_image_info_t pe_info;
|
||||||
BOOL is_child_64bit;
|
|
||||||
int unixdir, socketfd[2];
|
int unixdir, socketfd[2];
|
||||||
char **argv;
|
char **argv;
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
|
@ -601,7 +598,6 @@ NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTST
|
||||||
case STATUS_INVALID_IMAGE_NOT_MZ:
|
case STATUS_INVALID_IMAGE_NOT_MZ:
|
||||||
if (getenv( "WINEPRELOADRESERVE" )) return status;
|
if (getenv( "WINEPRELOADRESERVE" )) return status;
|
||||||
if ((status = get_pe_file_info( path, &handle, &pe_info ))) return status;
|
if ((status = get_pe_file_info( path, &handle, &pe_info ))) return status;
|
||||||
is_child_64bit = (pe_info.cpu == CPU_x86_64 || pe_info.cpu == CPU_ARM64);
|
|
||||||
break;
|
break;
|
||||||
case STATUS_INVALID_IMAGE_WIN_16:
|
case STATUS_INVALID_IMAGE_WIN_16:
|
||||||
case STATUS_INVALID_IMAGE_NE_FORMAT:
|
case STATUS_INVALID_IMAGE_NE_FORMAT:
|
||||||
|
@ -609,7 +605,6 @@ NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTST
|
||||||
/* we'll start winevdm */
|
/* we'll start winevdm */
|
||||||
memset( &pe_info, 0, sizeof(pe_info) );
|
memset( &pe_info, 0, sizeof(pe_info) );
|
||||||
pe_info.cpu = CPU_x86;
|
pe_info.cpu = CPU_x86;
|
||||||
is_child_64bit = FALSE;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return status;
|
return status;
|
||||||
|
@ -642,8 +637,7 @@ NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTST
|
||||||
fchdir( unixdir );
|
fchdir( unixdir );
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
status = exec_wineloader( argv, socketfd[0], is_child_64bit,
|
status = exec_wineloader( argv, socketfd[0], &pe_info );
|
||||||
pe_info.base, pe_info.base + pe_info.map_size );
|
|
||||||
}
|
}
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
while (errno == ENOTSUP && terminate_main_thread());
|
while (errno == ENOTSUP && terminate_main_thread());
|
||||||
|
|
|
@ -157,8 +157,7 @@ extern void init_environment( int argc, char *argv[], char *envp[] ) DECLSPEC_HI
|
||||||
extern DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen ) DECLSPEC_HIDDEN;
|
extern DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen ) DECLSPEC_HIDDEN;
|
||||||
extern int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict ) DECLSPEC_HIDDEN;
|
extern int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict ) DECLSPEC_HIDDEN;
|
||||||
extern char **build_envp( const WCHAR *envW ) DECLSPEC_HIDDEN;
|
extern char **build_envp( const WCHAR *envW ) DECLSPEC_HIDDEN;
|
||||||
extern NTSTATUS exec_wineloader( char **argv, int socketfd, int is_child_64bit,
|
extern NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_info ) DECLSPEC_HIDDEN;
|
||||||
ULONGLONG res_start, ULONGLONG res_end ) DECLSPEC_HIDDEN;
|
|
||||||
extern void start_server( BOOL debug ) DECLSPEC_HIDDEN;
|
extern void start_server( BOOL debug ) DECLSPEC_HIDDEN;
|
||||||
extern ULONG_PTR get_image_address(void) DECLSPEC_HIDDEN;
|
extern ULONG_PTR get_image_address(void) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue