Alexandre Julliard : ntdll: Use a Wine-specific field in WINE_MODREF for the .so handle.

Alexandre Julliard julliard at winehq.org
Thu Apr 16 16:45:12 CDT 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Apr 16 12:00:43 2020 +0200

ntdll: Use a Wine-specific field in WINE_MODREF for the .so handle.

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

---

 dlls/ntdll/loader.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index c67e1a3d2b..c32292d453 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -121,6 +121,7 @@ typedef struct _wine_modref
     LDR_MODULE            ldr;
     dev_t                 dev;
     ino_t                 ino;
+    void                 *so_handle;
     int                   alloc_deps;
     int                   nDeps;
     struct _wine_modref **deps;
@@ -585,7 +586,7 @@ static WINE_MODREF *find_so_module( void *handle )
         LDR_MODULE *mod = CONTAINING_RECORD( entry, LDR_MODULE, InLoadOrderModuleList );
         WINE_MODREF *wm = CONTAINING_RECORD( mod, WINE_MODREF, ldr );
 
-        if (mod->Flags & LDR_WINE_INTERNAL && mod->SectionHandle == handle) return wm;
+        if (wm->so_handle == handle) return wm;
     }
     return NULL;
 }
@@ -2806,7 +2807,7 @@ static NTSTATUS load_so_dll( LPCWSTR load_path, const UNICODE_STRING *nt_name,
             TRACE_(loaddll)( "Loaded %s at %p: builtin\n",
                              debugstr_w(info.wm->ldr.FullDllName.Buffer), info.wm->ldr.BaseAddress );
             info.wm->ldr.LoadCount = 1;
-            info.wm->ldr.SectionHandle = handle;
+            info.wm->so_handle = handle;
         }
     }
     else if (!info.wm)
@@ -2829,7 +2830,7 @@ static NTSTATUS load_so_dll( LPCWSTR load_path, const UNICODE_STRING *nt_name,
     {
         TRACE_(loaddll)( "Loaded %s at %p: builtin\n", debugstr_w(info.wm->ldr.FullDllName.Buffer), info.wm->ldr.BaseAddress );
         info.wm->ldr.LoadCount = 1;
-        info.wm->ldr.SectionHandle = handle;
+        info.wm->so_handle = handle;
     }
 
     *pwm = info.wm;
@@ -3760,7 +3761,7 @@ static void free_modref( WINE_MODREF *wm )
 
     free_tls_slot( &wm->ldr );
     RtlReleaseActivationContext( wm->ldr.ActivationContext );
-    if ((wm->ldr.Flags & LDR_WINE_INTERNAL) && wm->ldr.SectionHandle) dlclose( wm->ldr.SectionHandle );
+    if (wm->so_handle) dlclose( wm->so_handle );
     NtUnmapViewOfSection( NtCurrentProcess(), wm->ldr.BaseAddress );
     if (cached_modref == wm) cached_modref = NULL;
     RtlFreeUnicodeString( &wm->ldr.FullDllName );




More information about the wine-cvs mailing list