Changeset 2069 for trunk/src/kernel32


Ignore:
Timestamp:
Dec 13, 1999, 10:07:40 PM (26 years ago)
Author:
sandervl
Message:

dll unload fix

Location:
trunk/src/kernel32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/windllbase.cpp

    r2001 r2069  
    1 /* $Id: windllbase.cpp,v 1.6 1999-12-06 21:31:43 sandervl Exp $ */
     1/* $Id: windllbase.cpp,v 1.7 1999-12-13 21:07:40 sandervl Exp $ */
    22
    33/*
     
    66 * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl)
    77 *
     8 * TODO: Unloading of system dlls is not correct for the PE loader
     9 *       (they're always put at the head of the list even though there
     10 *        might be a dependency with a win32 dll)
    811 *
    912 * Project Odin Software License can be found in LICENSE.TXT
     
    3942//******************************************************************************
    4043//******************************************************************************
    41 Win32DllBase::Win32DllBase(HINSTANCE hinstance, WIN32DLLENTRY DllEntryPoint)
     44Win32DllBase::Win32DllBase(HINSTANCE hinstance, WIN32DLLENTRY DllEntryPoint,
     45                           Win32ImageBase *parent)
    4246                 : Win32ImageBase(hinstance),
    4347                   referenced(0), fSkipEntryCalls(FALSE),
     
    4751
    4852  dlllistmutex.enter();
    49   next = head;
    50   head = this;
     53  //unload of dlls needs to be done in reverse order of dependencies
     54  //Note: Only necessary for pe loader; the OS/2 loader takes care of this
     55  //for win32k/pe2lx
     56  if(parent && parent->isDll()) {
     57        Win32DllBase *dll = head;
     58        while(dll) {
     59                if(dll->getInstanceHandle() == parent->getInstanceHandle()) {
     60                        break;
     61                }
     62                dll = dll->next;
     63        }
     64        if(dll) {
     65                //insert this dll in list after it's parent
     66                next = dll->next;
     67                dll->next = this;
     68        }
     69        else    DebugInt3();
     70  }
     71  else {
     72        next = head;
     73        head = this;
     74  }
    5175  dlllistmutex.leave();
     76
     77#ifdef DEBUG_ENABLELOG_LEVEL2
     78  dlllistmutex.enter();
     79  Win32DllBase *dll = head;
     80
     81  dprintf2(("Win32DllBase::Win32DllBase: List of loaded dlls:"));
     82  while(dll) {
     83        dprintf2(("DLL %s", dll->szModule));
     84        dll = dll->next;
     85  }
     86  dlllistmutex.leave();
     87#endif
    5288
    5389  dprintf(("Win32DllBase::Win32DllBase %x %s", hinstance, szModule));
  • trunk/src/kernel32/windlllx.cpp

    r1844 r2069  
    1 /* $Id: windlllx.cpp,v 1.5 1999-11-26 00:05:19 sandervl Exp $ */
     1/* $Id: windlllx.cpp,v 1.6 1999-12-13 21:07:40 sandervl Exp $ */
    22
    33/*
     
    99 * TODO: Unloading of dlls probably needs to be fixed due to OS/2 bug
    1010 *       (wrong unload order of dlls)
     11 * TODO: Unloading of system dlls is not correct for the PE loader
     12 *       (they're always put at the head of the list even though there
     13 *        might be a dependency with a win32 dll)
    1114 *
    1215 * Project Odin Software License can be found in LICENSE.TXT
  • trunk/src/kernel32/windllpeldr.cpp

    r1844 r2069  
    1 /* $Id: windllpeldr.cpp,v 1.4 1999-11-26 00:05:19 sandervl Exp $ */
     1/* $Id: windllpeldr.cpp,v 1.5 1999-12-13 21:07:40 sandervl Exp $ */
    22
    33/*
     
    3636Win32PeLdrDll::Win32PeLdrDll(char *szDllName, Win32ImageBase *parentImage)
    3737                : Win32ImageBase(-1),
    38                   Win32DllBase(-1, 0),
     38                  Win32DllBase(-1, 0, parentImage),
    3939                  Win32PeLdrImage(szDllName, FALSE)
    4040{
Note: See TracChangeset for help on using the changeset viewer.