Alexandre Julliard : kernel32: Add the new image path to the dll path for a new process.
Alexandre Julliard
julliard at winehq.org
Mon Oct 21 15:28:36 CDT 2019
Module: wine
Branch: master
Commit: c258b5ef1100c8c238aab0a17ca743a326829aac
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c258b5ef1100c8c238aab0a17ca743a326829aac
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sun Oct 20 13:54:05 2019 +0200
kernel32: Add the new image path to the dll path for a new process.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/process.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index d2682ac83e..693179fa05 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -1885,9 +1885,9 @@ static RTL_USER_PROCESS_PARAMETERS *create_process_params( LPCWSTR filename, LPC
const STARTUPINFOW *startup )
{
RTL_USER_PROCESS_PARAMETERS *params;
- UNICODE_STRING imageW, curdirW, cmdlineW, titleW, desktopW, runtimeW, newdirW;
+ UNICODE_STRING imageW, dllpathW, curdirW, cmdlineW, titleW, desktopW, runtimeW, newdirW;
WCHAR imagepath[MAX_PATH];
- WCHAR *envW = env;
+ WCHAR *load_path, *dummy, *envW = env;
if(!GetLongPathNameW( filename, imagepath, MAX_PATH ))
lstrcpynW( imagepath, filename, MAX_PATH );
@@ -1914,20 +1914,24 @@ static RTL_USER_PROCESS_PARAMETERS *create_process_params( LPCWSTR filename, LPC
else
cur_dir = NULL;
}
+ LdrGetDllPath( imagepath, LOAD_WITH_ALTERED_SEARCH_PATH, &load_path, &dummy );
RtlInitUnicodeString( &imageW, imagepath );
+ RtlInitUnicodeString( &dllpathW, load_path );
RtlInitUnicodeString( &curdirW, cur_dir );
RtlInitUnicodeString( &cmdlineW, cmdline );
RtlInitUnicodeString( &titleW, startup->lpTitle ? startup->lpTitle : imagepath );
RtlInitUnicodeString( &desktopW, startup->lpDesktop );
runtimeW.Buffer = (WCHAR *)startup->lpReserved2;
runtimeW.Length = runtimeW.MaximumLength = startup->cbReserved2;
- if (RtlCreateProcessParametersEx( ¶ms, &imageW, NULL, cur_dir ? &curdirW : NULL,
+ if (RtlCreateProcessParametersEx( ¶ms, &imageW, &dllpathW, cur_dir ? &curdirW : NULL,
&cmdlineW, envW, &titleW, &desktopW,
NULL, &runtimeW, PROCESS_PARAMS_FLAG_NORMALIZED ))
{
+ RtlReleasePath( load_path );
if (envW != env) HeapFree( GetProcessHeap(), 0, envW );
return NULL;
}
+ RtlReleasePath( load_path );
if (flags & CREATE_NEW_PROCESS_GROUP) params->ConsoleFlags = 1;
if (flags & CREATE_NEW_CONSOLE) params->ConsoleHandle = KERNEL32_CONSOLE_ALLOC;
More information about the wine-cvs
mailing list