Changeset 9828 for trunk/src/kernel32/windlllx.cpp
- Timestamp:
- Feb 20, 2003, 10:47:01 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/windlllx.cpp
r9411 r9828 1 /* $Id: windlllx.cpp,v 1.2 6 2002-11-18 13:53:54sandervl Exp $ */1 /* $Id: windlllx.cpp,v 1.27 2003-02-20 09:47:01 sandervl Exp $ */ 2 2 3 3 /* … … 34 34 #include <wprocess.h> 35 35 #include "oslibmisc.h" 36 #include <custombuild.h> 36 37 37 38 #include <exe386.h> … … 40 41 #include "dbglocal.h" 41 42 43 /******************************************************************************* 44 * Global Variables * 45 *******************************************************************************/ 42 46 char *lpszCustomDllName = NULL; 43 47 char *lpszCustomExportPrefix = NULL; 44 48 ULONG dwOrdinalBase = 0; 45 49 50 /** 51 * FreeLibrary callback for LX Dlls, it's call only when the library is actually 52 * being unloaded. 53 * Maintained by ODIN_SetLxDllUnLoadCallback(). 54 */ 55 PFNLXDLLUNLOAD pfnLxDllUnLoadCallback = NULL; 56 46 57 //****************************************************************************** 47 58 //****************************************************************************** 48 59 void WIN32API SetCustomBuildName(char *lpszName, DWORD ordinalbase, 49 char *lpszExportPrefix) 60 char *lpszExportPrefix) 50 61 { 51 62 lpszCustomDllName = lpszName; … … 261 272 ULONG Win32LxDll::Release() 262 273 { 263 HINSTANCE hinst; 274 HINSTANCE hinst = hinstanceOS2; 275 HINSTANCE hinstOdin = hinstance; 264 276 WIN32DLLENTRY EntryPointTmp = dllEntryPoint; 265 277 PVOID pResDataTmp = (PVOID)pResRootDir; … … 267 279 DWORD MinorImageVersionTmp = MinorImageVersion; 268 280 DWORD SubsystemTmp = Subsystem; 281 BOOL fNoUnload = fDisableUnload; //only set for kernel32.dll 282 BOOL fDynLoaded = isDynamicLib(); 269 283 ULONG ret; 270 284 APIRET rc; 271 BOOL fNoUnload = fDisableUnload; //only set for kernel32.dll 272 Win32LxDll *pModule; 273 274 hinst = hinstanceOS2; 285 275 286 ret = Win32DllBase::Release(); 276 if(ret == 0 && !fNoUnload) {//only set for kernel32.dll (fDisableUnload) 287 288 /** @sketch 289 * If this module is not unreference and it was loaded using LoadLibrary() then 290 * call the custombuild callback if present. 291 * The callback should call UnRegisterLxDll(). 292 * Endif 293 * 294 * @remark 295 * #ifdef HACK_NEVER_UNLOAD_LX_DLLS 296 * This will never be called! 297 * #endif 298 * 299 * @todo: call pfnLxDllLoadCallback if DosFreeModule failes. 300 * It's not implemented because it's complex and at the moment we will 301 * never actually get here. 302 * So, this callback is here just as a reminder eventhough it's working.. 303 */ 304 if (!ret && fDynLoaded && pfnLxDllUnLoadCallback) 305 { 306 pfnLxDllUnLoadCallback(hinstanceOS2, hinstance); 307 } 308 309 if (ret == 0 && !fNoUnload) {//only set for kernel32.dll (fDisableUnload) 277 310 //DosFreeModule sends a termination message to the dll. 278 311 //The LX dll informs us when it's removed (UnregisterDll call) … … 280 313 if(rc) { 281 314 dprintf(("Win32LxDll::Release: DosFreeModule %x returned %d", hinst, rc)); 282 if(rc == ERROR_INVALID_ACCESS && !fExitProcess) 315 if(rc == ERROR_INVALID_ACCESS && !fExitProcess) 283 316 { 317 #ifndef HACK_NEVER_UNLOAD_LX_DLLS 318 #error @todo: call pfnLxDllLoadCallback and let it do the registering if it did that on the initial load.. 319 #endif 284 320 //Dll refused to unload because it has an active exitlist handler 285 321 //or depends on a dll that registered an exitlist handler … … 295 331 296 332 /* OS/2 dll, system dll, converted dll or win32k took care of it. */ 297 pModule = Win32LxDll::findModuleByOS2Handle(hinst);333 Win32LxDll *pModule = Win32LxDll::findModuleByOS2Handle(hinst); 298 334 if(pModule) 299 335 { … … 365 401 //****************************************************************************** 366 402 //****************************************************************************** 403 404 /** 405 * Custombuild API for registering a callback for LX Dll loading thru LoadLibrary*(). 406 * @returns Success indicator. 407 * @param pfn Pointer to callback. 408 * NULL if callback is deregistered. 409 */ 410 BOOL WIN32API ODIN_SetLxDllUnLoadCallback(PFNLXDLLUNLOAD pfn) 411 { 412 pfnLxDllUnLoadCallback = pfn; 413 return TRUE; 414 } 415
Note:
See TracChangeset
for help on using the changeset viewer.