ntdll: Check the main image for Unix path only the first time around.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50858
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-03-25 11:24:35 +01:00
parent 15a6ee9440
commit 967100258f
3 changed files with 9 additions and 9 deletions

View File

@ -1871,7 +1871,7 @@ static RTL_USER_PROCESS_PARAMETERS *build_initial_params(void)
add_registry_environment( &env, &env_pos, &env_size );
env[env_pos++] = 0;
status = load_main_exe( main_wargv[0], curdir, &image, &module, &image_info );
status = load_main_exe( main_wargv[0], main_argv[0], curdir, &image, &module, &image_info );
if (!status && image_info.Machine != current_machine) /* need to restart for Wow64 */
{
NtUnmapViewOfSection( GetCurrentProcess(), module );
@ -1888,7 +1888,7 @@ static RTL_USER_PROCESS_PARAMETERS *build_initial_params(void)
free( image );
prepend_main_wargv( args, 3 );
if ((status = load_main_exe( startW, curdir, &image, &module, &image_info )))
if ((status = load_main_exe( startW, NULL, curdir, &image, &module, &image_info )))
{
MESSAGE( "wine: failed to start %s\n", debugstr_w(main_wargv[2]) );
NtTerminateProcess( GetCurrentProcess(), status );
@ -2042,7 +2042,7 @@ void init_startup_info(void)
free( info );
NtCurrentTeb()->Peb->ProcessParameters = params;
status = load_main_exe( params->ImagePathName.Buffer, params->CommandLine.Buffer,
status = load_main_exe( params->ImagePathName.Buffer, NULL, params->CommandLine.Buffer,
&image, &module, &image_info );
if (status)
{

View File

@ -1500,8 +1500,8 @@ static NTSTATUS open_main_image( WCHAR *image, void **module, SECTION_IMAGE_INFO
/***********************************************************************
* load_main_exe
*/
NTSTATUS load_main_exe( const WCHAR *name, const WCHAR *curdir, WCHAR **image, void **module,
SECTION_IMAGE_INFORMATION *image_info )
NTSTATUS load_main_exe( const WCHAR *name, const char *unix_name, const WCHAR *curdir,
WCHAR **image, void **module, SECTION_IMAGE_INFORMATION *image_info )
{
UNICODE_STRING nt_name;
NTSTATUS status;
@ -1510,9 +1510,9 @@ NTSTATUS load_main_exe( const WCHAR *name, const WCHAR *curdir, WCHAR **image, v
const WCHAR *p;
/* special case for Unix file name */
if (main_argv[0][0] == '/' && !stat( main_argv[0], &st ))
if (unix_name && unix_name[0] == '/' && !stat( unix_name, &st ))
{
if ((status = unix_to_nt_file_name( main_argv[0], image ))) goto failed;
if ((status = unix_to_nt_file_name( unix_name, image ))) goto failed;
status = open_main_image( *image, module, image_info );
if (status != STATUS_DLL_NOT_FOUND) return status;
free( *image );

View File

@ -143,8 +143,8 @@ extern char **build_envp( const WCHAR *envW ) DECLSPEC_HIDDEN;
extern NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_info ) DECLSPEC_HIDDEN;
extern NTSTATUS load_builtin( const pe_image_info_t *image_info, const WCHAR *filename,
void **addr_ptr, SIZE_T *size_ptr ) DECLSPEC_HIDDEN;
extern NTSTATUS load_main_exe( const WCHAR *name, const WCHAR *curdir, WCHAR **image, void **module,
SECTION_IMAGE_INFORMATION *image_info ) DECLSPEC_HIDDEN;
extern NTSTATUS load_main_exe( const WCHAR *name, const char *unix_name, const WCHAR *curdir, WCHAR **image,
void **module, SECTION_IMAGE_INFORMATION *image_info ) DECLSPEC_HIDDEN;
extern void start_server( BOOL debug ) DECLSPEC_HIDDEN;
extern ULONG_PTR get_image_address(void) DECLSPEC_HIDDEN;