shell32: Pass the executable's full path from SHELL_execute() to CreateProcess().

Several older Microsoft installers, particularly those changing CDs
during installation, break because they launch a child setup.exe, from
a parent process also called setup.exe, which Wine finds in the wrong
directory, as CreateProcess() first searches the parent executable's
own directory, thus re-launching the parent itself instead of the
child.  Therefore CreateProcess() must be passed a full path from
SHELL_execute(), so it launches the correct child.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=8439
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Damjan Jovanovic 2020-03-22 13:46:23 +02:00 committed by Alexandre Julliard
parent 06f1f53c4c
commit 9736fe499d
2 changed files with 12 additions and 4 deletions

View File

@ -1807,6 +1807,14 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
lpFile = sei_tmp.lpFile;
wcmd = wcmdBuffer;
strcpyW(wcmd, wszApplicationName);
if (sei_tmp.lpDirectory)
{
LPCWSTR searchPath[] = {
sei_tmp.lpDirectory,
NULL
};
PathFindOnPathW(wcmd, searchPath);
}
retval = SHELL_quote_and_execute( wcmd, wszParameters, wszEmpty,
wszApplicationName, NULL, &sei_tmp,
sei, execfunc );

View File

@ -2842,7 +2842,7 @@ static void test_directory(void)
NULL, "test2.exe", params, tmpdir, NULL);
okShell(rc > 32, "returned %lu\n", rc);
okChildInt("argcA", 4);
todo_wine okChildString("argvA0", path);
okChildString("argvA0", path);
okChildString("argvA3", "Exec");
okChildPath("longPath", path);
@ -2855,7 +2855,7 @@ static void test_directory(void)
NULL, "test2.exe", params, "%TMPDIR%", NULL);
okShell(rc > 32, "returned %lu\n", rc);
okChildInt("argcA", 4);
todo_wine okChildString("argvA0", path);
okChildString("argvA0", path);
okChildString("argvA3", "Exec");
okChildPath("longPath", path);
@ -2872,9 +2872,9 @@ static void test_directory(void)
NULL, strrchr(argv0, '\\') + 1, params, tmpdir, NULL);
okShell(rc > 32, "returned %lu\n", rc);
okChildInt("argcA", 4);
todo_wine okChildString("argvA0", path);
okChildString("argvA0", path);
okChildString("argvA3", "Exec");
todo_wine okChildPath("longPath", path);
okChildPath("longPath", path);
DeleteFileA(path);
}