Commit 85d029e3 authored by Yuxuan Shui's avatar Yuxuan Shui Committed by Alexandre Julliard

shell32: Rely solely on SHELL_FindExecutable for ShellExecute.

This does two things: 1. ShellExecute no longer searches in the directory where the current executable is in. 2. We always CreateProcess with a fully qualified path, so we CreateProcess won't do its own path resolution. Serendipitously this also fixes some existing todos in tests.
parent 1bc7db2e
......@@ -1823,30 +1823,8 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
wcmd = malloc(len * sizeof(WCHAR));
wcmdLen = len;
}
lstrcpyW(wcmd, wszApplicationName);
if (sei_tmp.lpDirectory)
{
LPCWSTR searchPath[] = {
sei_tmp.lpDirectory,
NULL
};
PathFindOnPathW(wcmd, searchPath);
}
retval = SHELL_quote_and_execute( wcmd, wszParameters, L"",
wszApplicationName, NULL, &sei_tmp,
sei, execfunc );
if (retval > 32) {
free(wszApplicationName);
if (wszParameters != parametersBuffer)
free(wszParameters);
if (wszDir != dirBuffer)
free(wszDir);
if (wcmd != wcmdBuffer)
free(wcmd);
return TRUE;
}
/* Else, try to find the executable */
/* try to find the executable */
wcmd[0] = '\0';
retval = SHELL_FindExecutable(sei_tmp.lpDirectory, lpFile, sei_tmp.lpVerb, wcmd, wcmdLen, wszKeyname, &env, sei_tmp.lpIDList, sei_tmp.lpParameters);
if (retval > 32) /* Found */
......
......@@ -2331,11 +2331,9 @@ static void test_exes(void)
if (CopyFileA(argv0, filename, FALSE))
{
rc=shell_execute(NULL, filename, params, NULL);
todo_wine {
okShell(rc==SE_ERR_NOASSOC, "returned %Iu\n", rc);
}
}
}
else
{
win_skip("Skipping shellexecute of file with unassociated extension\n");
......@@ -2359,7 +2357,7 @@ static void test_exes(void)
GetCurrentDirectoryA(MAX_PATH, curdir);
SetCurrentDirectoryA(tmpdir);
rc = shell_execute(NULL, basename, params, NULL);
todo_wine okShell(rc == SE_ERR_FNF, "returned %Iu\n", rc);
okShell(rc == SE_ERR_FNF, "returned %Iu\n", rc);
SetCurrentDirectoryA(curdir);
if (!skip_shlexec_tests)
......@@ -2956,7 +2954,7 @@ static void test_directory(void)
NULL, "test2.exe", params, NULL, NULL);
okShell(rc > 32, "returned %Iu\n", rc);
okChildInt("argcA", 4);
todo_wine okChildString("argvA0", path);
okChildString("argvA0", path);
okChildString("argvA3", "Exec");
okChildPath("longPath", path);
SetCurrentDirectoryA(curdir);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment