Alexandre Julliard : ntdll: The builtin load callback is no longer used for ntdll itself.

Alexandre Julliard julliard at winehq.org
Wed Apr 22 15:29:26 CDT 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Apr 22 15:50:44 2020 +0200

ntdll: The builtin load callback is no longer used for ntdll itself.

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

---

 dlls/ntdll/loader.c | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index e26b9d6b7f..b457d60f6b 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2058,21 +2058,14 @@ static NTSTATUS build_so_dll_module( const WCHAR *load_path, const UNICODE_STRIN
  */
 static void load_builtin_callback( void *module, const char *filename )
 {
-    static const WCHAR emptyW[1];
-    const WCHAR *load_path;
-
     if (!module)
     {
         ERR("could not map image for %s\n", debugstr_us(builtin_load_info->filename) );
         builtin_load_info->status = STATUS_NO_MEMORY;
         return;
     }
-
-    load_path = builtin_load_info->load_path;
-    if (!load_path) load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
-    if (!load_path) load_path = emptyW;
-
-    builtin_load_info->status = build_so_dll_module( load_path, builtin_load_info->filename, module,
+    builtin_load_info->status = build_so_dll_module( builtin_load_info->load_path,
+                                                     builtin_load_info->filename, module,
                                                      0, &builtin_load_info->wm );
 }
 
@@ -4482,7 +4475,7 @@ void __wine_process_init(void)
     NTSTATUS status;
     ANSI_STRING func_name;
     UNICODE_STRING nt_name;
-    HMODULE ntdll_module;
+    HMODULE ntdll_module = (HMODULE)((__wine_spec_nt_header.OptionalHeader.ImageBase + 0xffff) & ~0xffff);
     INITIAL_TEB stack;
     BOOL suspend;
     SIZE_T info_size;
@@ -4512,15 +4505,11 @@ void __wine_process_init(void)
 
     /* setup the load callback and create ntdll modref */
     RtlInitUnicodeString( &nt_name, ntdllW );
-    default_load_info.filename = &nt_name;
+    map_so_dll( &__wine_spec_nt_header, ntdll_module );
+    status = build_so_dll_module( params->DllPath.Buffer, &nt_name, ntdll_module, 0, &wm );
+    assert( !status );
+
     wine_dll_set_callback( load_builtin_callback );
-    ntdll_module = (HMODULE)((__wine_spec_nt_header.OptionalHeader.ImageBase + 0xffff) & ~0xffff);
-    if (!get_modref( ntdll_module ))
-    {
-        map_so_dll( &__wine_spec_nt_header, ntdll_module );
-        status = build_so_dll_module( params->DllPath.Buffer, &nt_name, ntdll_module, 0, &wm );
-        assert( !status );
-    }
 
     RtlInitUnicodeString( &nt_name, kernel32W );
     if ((status = load_builtin_dll( params->DllPath.Buffer, &nt_name, NULL, 0, &wm )) != STATUS_SUCCESS)




More information about the wine-cvs mailing list