Alexandre Julliard : ntdll: Don' t reset the load count when reusing a builtin modref.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 28 06:08:32 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 0335a4b910718bfd0ff14dc04a1348b6793d8372
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=0335a4b910718bfd0ff14dc04a1348b6793d8372

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Feb 28 12:41:25 2006 +0100

ntdll: Don't reset the load count when reusing a builtin modref.

---

 dlls/ntdll/loader.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 546d029..cdd860c 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -1420,6 +1420,7 @@ static NTSTATUS load_native_dll( LPCWSTR
 
     TRACE_(loaddll)( " Loaded module %s : native\n", debugstr_w(wm->ldr.FullDllName.Buffer) );
 
+    wm->ldr.LoadCount = 1;
     *pwm = wm;
     return STATUS_SUCCESS;
 }
@@ -1536,10 +1537,12 @@ static NTSTATUS load_builtin_dll( LPCWST
             }
         }
         if (!info.wm) return STATUS_INVALID_IMAGE_FORMAT;
+        if (info.wm->ldr.LoadCount != -1) info.wm->ldr.LoadCount++;
     }
     else
     {
         TRACE_(loaddll)( "Loaded module %s : builtin\n", debugstr_w(info.wm->ldr.FullDllName.Buffer) );
+        info.wm->ldr.LoadCount = 1;
         info.wm->ldr.SectionHandle = handle;
     }
 
@@ -1738,9 +1741,6 @@ static NTSTATUS load_dll( LPCWSTR load_p
         TRACE("Loaded module %s (%s) at %p\n", debugstr_w(filename),
               ((*pwm)->ldr.Flags & LDR_WINE_INTERNAL) ? "builtin" : "native",
               (*pwm)->ldr.BaseAddress);
-        /* Set the ldr.LoadCount here so that an attach failure will */
-        /* decrement the dependencies through the MODULE_FreeLibrary call. */
-        (*pwm)->ldr.LoadCount = 1;
         if (handle) NtClose( handle );
         if (filename != buffer) RtlFreeHeap( GetProcessHeap(), 0, filename );
         return nts;




More information about the wine-cvs mailing list