[PATCH 4/4] shell32: pass the executable's full path from SHELL_execute() to CreateProcess()
Damjan Jovanovic
damjan.jov at gmail.com
Sun Mar 22 06:46:23 CDT 2020
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.
It's about time this 13 year old bug was closed.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=8439
Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
---
dlls/shell32/shlexec.c | 8 ++++++++
dlls/shell32/tests/shlexec.c | 8 ++++----
2 files changed, 12 insertions(+), 4 deletions(-)
-------------- next part --------------
diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index d3ff821135..ce0b8f6d2b 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -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 );
diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index 583504e275..d2c9d370c5 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -2846,7 +2846,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);
@@ -2859,7 +2859,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);
@@ -2876,9 +2876,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);
}
More information about the wine-devel
mailing list