Changeset 3854 for trunk/src


Ignore:
Timestamp:
Jul 18, 2000, 8:37:30 PM (25 years ago)
Author:
sandervl
Message:

dll unload fix + detach skip fix

Location:
trunk/src/kernel32
Files:
4 edited

Legend:

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

    r3704 r3854  
    1 /* $Id: windllbase.cpp,v 1.14 2000-06-14 02:27:33 phaller Exp $ */
     1/* $Id: windllbase.cpp,v 1.15 2000-07-18 18:37:29 sandervl Exp $ */
    22
    33/*
     
    5151                           Win32ImageBase *parent)
    5252                 : Win32ImageBase(hinstance),
    53                    referenced(0), fSkipEntryCalls(FALSE), next(NULL), fInserted(FALSE),
     53                   referenced(0), fSkipThreadEntryCalls(FALSE), next(NULL), fInserted(FALSE),
    5454                   fAttachedToProcess(FALSE), fUnloaded(FALSE),
    5555                   nrDynamicLibRef(0), fLoadLibrary(FALSE), fDisableUnload(FALSE)
     
    101101{
    102102  if(nrDynamicLibRef == 0) {
     103        //NOTE:
     104        //Must be called *after* attachprocess, since attachprocess may also
     105        //trigger LoadLibrary calls
     106        //Those dlls must not be put in front of this dll in the dynamic
     107        //dll list; or else the unload order is wrong:
     108        //i.e. RPAP3260 loads PNRS3260 in DLL_PROCESS_ATTACH
     109        //     this means that in ExitProcess, PNRS3260 needs to be removed
     110        //     first since RPAP3260 depends on it
     111
    103112        dlllistmutex.enter();
    104113        loadLibDlls.Push((ULONG)this);
     
    411420  tlsAttachThread();    //setup TLS (main thread)
    412421
    413   if(fSkipEntryCalls || dllEntryPoint == NULL) {
     422  if(dllEntryPoint == NULL) {
    414423        dprintf(("attachProcess not required for dll %s", szModule));
    415424        if(fSetExceptionHandler) {
     
    458467 BOOL rc;
    459468
    460   if(fSkipEntryCalls || dllEntryPoint == NULL) {
     469  if(dllEntryPoint == NULL) {
    461470        tlsDetachThread();      //destroy TLS (main thread)
    462471        fUnloaded = TRUE;
     
    501510 BOOL               rc;
    502511
    503   if(fSkipEntryCalls || dllEntryPoint == NULL)
     512  if(fSkipThreadEntryCalls || dllEntryPoint == NULL)
    504513        return(TRUE);
    505514
     
    519528 BOOL               rc;
    520529
    521   if(fSkipEntryCalls || dllEntryPoint == NULL)
     530  if(fSkipThreadEntryCalls || dllEntryPoint == NULL)
    522531        return(TRUE);
    523532
     
    630639
    631640  dlllistmutex.leave();
     641  dprintf(("Win32DllBase::deleteDynamicLibs end"));
    632642}
    633643//******************************************************************************
     
    800810//******************************************************************************
    801811//******************************************************************************
    802 void Win32DllBase::setThreadLibraryCalls(BOOL fEnable)
    803 {
    804   // if fEnable == true, do call the ATTACH_THREAD, DETACH_THREAD functions
    805   // if fEnable == false, do not call the ATTACH_THREAD, DETACH_THREAD functions
    806   fSkipEntryCalls = !fEnable;
    807 }
    808 
    809 //******************************************************************************
    810 //******************************************************************************
    811812Win32DllBase *Win32DllBase::head = NULL;
    812813Queue         Win32DllBase::loadLibDlls;
  • trunk/src/kernel32/windllbase.h

    r3704 r3854  
    1 /* $Id: windllbase.h,v 1.3 2000-06-14 02:27:33 phaller Exp $ */
     1/* $Id: windllbase.h,v 1.4 2000-07-18 18:37:29 sandervl Exp $ */
    22
    33/*
     
    5050
    5151        char     *getName()          { return szModule; };
    52         void      setNoEntryCalls()  { fSkipEntryCalls = TRUE; };
     52
     53        //do not call the ATTACH_THREAD, DETACH_THREAD functions
     54        void      disableThreadLibraryCalls()  { fSkipThreadEntryCalls = TRUE; };
    5355
    5456        Win32DllBase *getNext()  { return next; };
     
    7173        BOOL      attachThread();
    7274        BOOL      detachThread();
    73 
    74         // enable / disable thread attach/detach calls
    75         void      setThreadLibraryCalls(BOOL fEnable);
    7675
    7776        //This counter is incremented when the dll has been loaded with LoadLibrary(Ex)
     
    126125#endif
    127126
    128         BOOL          fSkipEntryCalls, fUnloaded, fAttachedToProcess;
     127        BOOL          fSkipThreadEntryCalls, fUnloaded, fAttachedToProcess;
    129128
    130129        WIN32DLLENTRY dllEntryPoint;
  • trunk/src/kernel32/windlllx.cpp

    r3375 r3854  
    1 /* $Id: windlllx.cpp,v 1.10 2000-04-14 22:35:27 sandervl Exp $ */
     1/* $Id: windlllx.cpp,v 1.11 2000-07-18 18:37:29 sandervl Exp $ */
    22
    33/*
     
    143143{
    144144  if(EntryPoint == NULL) {
    145         fSkipEntryCalls    = TRUE;
     145        fSkipThreadEntryCalls    = TRUE;
    146146        fAttachedToProcess = TRUE;
    147147  }
  • trunk/src/kernel32/wprocess.cpp

    r3804 r3854  
    1 /* $Id: wprocess.cpp,v 1.83 2000-07-06 21:18:45 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.84 2000-07-18 18:37:30 sandervl Exp $ */
    22
    33/*
     
    831831        if (dwFlags & (DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE))
    832832        {
    833             peldrDll->setNoEntryCalls();
     833            peldrDll->disableThreadLibraryCalls();
    834834            //peldrDll->setDontProcessImports(); not implemented?
    835835        }
     
    866866        if (peldrDll->init(0))
    867867        {
    868             peldrDll->incDynamicLib();
    869868            peldrDll->AddRef();
    870             if (peldrDll->attachProcess())
     869            if (peldrDll->attachProcess()) {
    871870                hDll = peldrDll->getInstanceHandle();
     871                //Must be called *after* attachprocess, since attachprocess may also
     872                //trigger LoadLibrary calls
     873                //Those dlls must not be put in front of this dll in the dynamic
     874                //dll list; or else the unload order is wrong:
     875                //i.e. RPAP3260 loads PNRS3260 in DLL_PROCESS_ATTACH
     876                //     this means that in ExitProcess, PNRS3260 needs to be removed
     877                //     first since RPAP3260 depends on it
     878                peldrDll->incDynamicLib();
     879            }
    872880            else
    873881            {
     
    14801488  {
    14811489    // don't call ATTACH/DETACH thread functions in DLL
    1482     winmod->setThreadLibraryCalls(FALSE);
     1490    winmod->disableThreadLibraryCalls();
    14831491    return TRUE;
    14841492  }
Note: See TracChangeset for help on using the changeset viewer.