Alexandre Julliard : kernel32: Move dll load path initialization to ntdll.

Alexandre Julliard julliard at winehq.org
Tue Oct 22 16:57:00 CDT 2019


Module: wine
Branch: master
Commit: fd3735cf4dd55b5c582bd51bb03647e5eaf12847
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=fd3735cf4dd55b5c582bd51bb03647e5eaf12847

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Oct 22 10:17:36 2019 +0200

kernel32: Move dll load path initialization to ntdll.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/process.c | 4 ----
 dlls/ntdll/env.c        | 5 ++++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 55630dc6dd..36ed82bff8 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -1028,7 +1028,6 @@ void * CDECL __wine_kernel_init(void)
     RTL_USER_PROCESS_PARAMETERS *params = peb->ProcessParameters;
     HANDLE boot_events[2];
     BOOL got_environment = TRUE;
-    WCHAR *load_path, *dummy;
 
     /* Initialize everything */
 
@@ -1058,9 +1057,6 @@ void * CDECL __wine_kernel_init(void)
     TRACE( "starting process name=%s argv[0]=%s\n",
            debugstr_w(main_exe_name), debugstr_w(__wine_main_wargv[0]) );
 
-    LdrGetDllPath( main_exe_name, 0, &load_path, &dummy );
-    RtlInitUnicodeString( &NtCurrentTeb()->Peb->ProcessParameters->DllPath, load_path );
-
     if (boot_events[0])
     {
         DWORD timeout = 2 * 60 * 1000, count = 1;
diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c
index ac0e2621ed..919fc64e2f 100644
--- a/dlls/ntdll/env.c
+++ b/dlls/ntdll/env.c
@@ -1140,7 +1140,7 @@ static inline void get_unicode_string( UNICODE_STRING *str, WCHAR **src, UINT le
  */
 void init_user_process_params( SIZE_T data_size )
 {
-    WCHAR *src;
+    WCHAR *src, *load_path, *dummy;
     SIZE_T info_size, env_size;
     NTSTATUS status;
     startup_info_t *info = NULL;
@@ -1160,6 +1160,9 @@ void init_user_process_params( SIZE_T data_size )
         get_image_path( __wine_main_argv[0], &params->ImagePathName );
         set_library_wargv( __wine_main_argv, &params->ImagePathName );
         build_command_line( __wine_main_wargv, &params->CommandLine );
+        LdrGetDllPath( params->ImagePathName.Buffer, 0, &load_path, &dummy );
+        RtlCreateUnicodeString( &params->DllPath, load_path );
+        RtlReleasePath( load_path );
 
         if (isatty(0) || isatty(1) || isatty(2))
             params->ConsoleHandle = (HANDLE)2; /* see kernel32/kernel_private.h */




More information about the wine-cvs mailing list