Alexandre Julliard : ntdll: Load builtin exe without a corresponding file only before the prefix is fully initialized.

Alexandre Julliard julliard at winehq.org
Tue Mar 30 15:19:49 CDT 2021


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Mar 30 09:59:01 2021 +0200

ntdll: Load builtin exe without a corresponding file only before the prefix is fully initialized.

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

---

 dlls/ntdll/unix/loader.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index 40172afe4f1..9aab5102b8a 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -118,6 +118,7 @@ static char *argv0;
 static const char *bin_dir;
 static const char *dll_dir;
 static SIZE_T dll_path_maxlen;
+static BOOL is_prefix_bootstrap;
 
 const char *home_dir = NULL;
 const char *data_dir = NULL;
@@ -310,6 +311,8 @@ static void set_config_dir(void)
 static void init_paths( char *argv[] )
 {
     Dl_info info;
+    struct stat st;
+    char *ntdll;
 
     argv0 = strdup( argv[0] );
 
@@ -332,6 +335,10 @@ static void init_paths( char *argv[] )
     set_dll_path();
     set_home_dir();
     set_config_dir();
+
+    ntdll = build_path( config_dir, "dosdevices/c:/windows/system32/ntdll.dll" );
+    is_prefix_bootstrap = stat( ntdll, &st ) == -1;
+    free( ntdll );
 }
 
 
@@ -1456,6 +1463,8 @@ BOOL is_builtin_path( const UNICODE_STRING *path, WORD *machine )
                                    's','y','s','w','o','w','6','4'};
     unsigned int len;
 
+    if (!is_prefix_bootstrap) return FALSE;
+
     *machine = current_machine;
     if (path->Length > wcslen(system_dir) * sizeof(WCHAR) &&
         !wcsnicmp( path->Buffer, system_dir, wcslen(system_dir) ))




More information about the wine-cvs mailing list