Changeset 5075 for trunk/src/kernel32/windlllx.cpp
- Timestamp:
- Feb 9, 2001, 7:31:06 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/windlllx.cpp
r4433 r5075 1 /* $Id: windlllx.cpp,v 1.1 6 2000-10-05 18:36:49sandervl Exp $ */1 /* $Id: windlllx.cpp,v 1.17 2001-02-09 18:31:05 sandervl Exp $ */ 2 2 3 3 /* … … 32 32 #include "winexepeldr.h" 33 33 #include <odinlx.h> 34 #include <wprocess.h> 34 35 #include "oslibmisc.h" 35 36 … … 71 72 //once for a dll (to make sure OS/2 doesn't unload the dll when it's 72 73 //still needed) 74 //testestest 73 75 rc = DosLoadModule(szErrName, sizeof(szErrName), szFileName, &hInstance); 74 76 if(rc != 0) { … … 76 78 return 0; 77 79 } 80 //testestest 78 81 windll = new Win32LxDll(hInstance, EntryPoint, pResData, MajorImageVersion, 79 82 MinorImageVersion, Subsystem); … … 125 128 windll->addDependency(windlldep); 126 129 } 130 else dprintf(("WARNING: Can't find dll %s referenced by %s", modulename, windll->getModuleName())); 127 131 offset += modsize + 1; 128 132 } … … 164 168 Win32DllBase(hInstance, EntryPoint) 165 169 { 170 this->MajorImageVersion = MajorImageVersion; 171 this->MinorImageVersion = MinorImageVersion; 172 this->Subsystem = Subsystem; 173 166 174 if(EntryPoint == NULL) { 167 175 fSkipThreadEntryCalls = TRUE; … … 229 237 ULONG Win32LxDll::Release() 230 238 { 231 HINSTANCE hinst; 232 ULONG ret; 233 APIRET rc; 234 BOOL fNoUnload = fDisableUnload; //only set for kernel32.dll 239 HINSTANCE hinst; 240 WIN32DLLENTRY EntryPointTmp = dllEntryPoint; 241 PVOID pResDataTmp = (PVOID)pResRootDir; 242 DWORD MajorImageVersionTmp = MajorImageVersion; 243 DWORD MinorImageVersionTmp = MinorImageVersion; 244 DWORD SubsystemTmp = Subsystem; 245 ULONG ret; 246 APIRET rc; 247 BOOL fNoUnload = fDisableUnload; //only set for kernel32.dll 248 Win32LxDll *pModule; 235 249 236 250 hinst = hinstanceOS2; … … 241 255 rc = DosFreeModule(hinst); 242 256 if(rc) { 243 dprintf(("Win32LxDll::Release: DosFreeModule %x returned %d", hinst, rc)); 257 dprintf(("Win32LxDll::Release: DosFreeModule %x returned %d", hinst, rc)); 258 if(rc == ERROR_INVALID_ACCESS && !fExitProcess) { 259 //Dll refused to unload because it has an active exitlist handler 260 //or depends on a dll that registered an exitlist handler 261 //In this case the handle remains valid and the entrypoint of 262 //the dll is NOT called for DLL_PROCESS_DETACH 263 //WORKAROUND: Re-register the dll so future LoadLibrary calls 264 // don't fail! 265 dprintf(("WORKAROUND: Re-register the dll so future LoadLibrary calls don't fail!")); 266 RegisterLxDll(hinst, EntryPointTmp, pResDataTmp, 267 MajorImageVersionTmp, 268 MinorImageVersionTmp, 269 SubsystemTmp); 270 271 /* OS/2 dll, system dll, converted dll or win32k took care of it. */ 272 pModule = Win32LxDll::findModuleByOS2Handle(hinst); 273 if(pModule) 274 { 275 pModule->setDllHandleOS2(hinst); 276 if(fPeLoader) 277 { 278 if(pModule->AddRef() == -1) {//-1 -> load failed (attachProcess) 279 dprintf(("ERROR Dll refused to be loaded; aborting")); 280 DebugInt3(); 281 delete pModule; 282 return 0; 283 } 284 } 285 pModule->incDynamicLib(); 286 } 287 else DebugInt3(); 288 } 244 289 } 245 290 }
Note:
See TracChangeset
for help on using the changeset viewer.