process exit and FreeLibrary

Eric Pouech eric.pouech at wanadoo.fr
Thu Nov 14 15:32:07 CST 2002


current loader (well here we're taking about un-loader) code might be a
bit buggy when stopping a process
on one hand, we force a brutal removal of all loaded DLLs
on the other hands, if a brain dead programmer calls FreeLibrary while
processing the PROCESS_DETACH notification, we we trying no nicely
unload the DLLs, taking into account ref counting and the likes
those two approches tend not to behave well together
this patch simply prevents FreeLibrary to do its job when a process
unloads.

(BTW, this should fix P Millar's bug on Word exit. BTW, thanks Paul for
the detailed logs of the pb)

A+
-------------- next part --------------
Name:          pcsfl
ChangeLog:     don't fully process FreeLibrary when process is stopping
License:       X11
GenDate:       2002/11/14 21:26:43 UTC
ModifiedFiles: loader/module.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/loader/module.c,v
retrieving revision 1.167
diff -u -u -r1.167 module.c
--- loader/module.c	23 Oct 2002 20:20:59 -0000	1.167
+++ loader/module.c	14 Nov 2002 21:25:16 -0000
@@ -1437,6 +1437,11 @@
     BOOL retv = FALSE;
     WINE_MODREF *wm;
 
+    /* if we're stopping the whole process (and forcing the removal of all
+     * DLLs, the library will be freed anyway.
+     */
+    if (process_detaching) return TRUE;
+
     if (!hLibModule)
     {
         SetLastError( ERROR_INVALID_HANDLE );


More information about the wine-patches mailing list