[PATCH] kernel32: Consider the working directory first when launching executables with CreateProcess.
Alexandre Julliard
julliard at winehq.org
Fri Apr 26 06:31:37 CDT 2019
Vijay Kiran Kamuju <infyquest at gmail.com> writes:
> @@ -439,9 +439,17 @@ static HANDLE open_exe_file( const WCHAR *name, BOOL *is_64bit )
> */
> static BOOL find_exe_file( const WCHAR *name, WCHAR *buffer, int buflen, HANDLE *handle )
> {
> + WCHAR cur_dir[MAX_PATH];
> +
> TRACE("looking for %s\n", debugstr_w(name) );
>
> - if (!SearchPathW( NULL, name, exeW, buflen, buffer, NULL ) &&
> + /* The working directory takes precedence over other locations for CreateProcess unless the
> + * 'NoDefaultCurrentDirectoryInExePath' environment variable is set (and the executable name
> + * does not contain a backslash). */
> + if ((NeedCurrentDirectoryForExePathW( name ) && GetCurrentDirectoryW( MAX_PATH, cur_dir) &&
> + !SearchPathW( cur_dir, name, exeW, buflen, buffer, NULL )) &&
> + /* not found in the working directory, try the system search path */
> + !SearchPathW( NULL, name, exeW, buflen, buffer, NULL ) &&
This will break the search if the variable is set.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list