- Timestamp:
- Aug 11, 2000, 12:56:27 PM (25 years ago)
- Location:
- trunk/src
- Files:
-
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/NTDLL/initterm.cpp
r2650 r3993 1 /* $Id: initterm.cpp,v 1. 9 2000-02-05 02:05:00sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.10 2000-08-11 10:56:11 sandervl Exp $ */ 2 2 3 3 /* … … 44 44 extern DWORD _Resource_PEResTab; 45 45 } 46 static HMODULE dllHandle = 0; 46 47 47 48 BOOL WINAPI NTDLL_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); … … 91 92 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 92 93 93 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 94 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 95 if(dllHandle == 0) 94 96 return 0UL; 95 97 96 98 break; 97 99 case 1 : 98 UnregisterLxDll(hModule); 100 if(dllHandle) { 101 UnregisterLxDll(dllHandle); 102 } 99 103 break; 104 100 105 default : 101 106 return 0UL; -
trunk/src/Odin32API/odindll.cpp
r976 r3993 1 /* $Id: odindll.cpp,v 1. 1 1999-09-18 17:46:28sandervl Exp $ */1 /* $Id: odindll.cpp,v 1.2 2000-08-11 10:56:12 sandervl Exp $ */ 2 2 3 3 /* … … 43 43 extern DWORD _Resource_PEResTab; 44 44 } 45 static HMODULE dllHandle = 0; 45 46 46 47 BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); … … 86 87 /*******************************************************************/ 87 88 88 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 89 return 0UL; 89 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 90 if(dllHandle == 0) 91 return 0UL; 90 92 91 93 rc = DosExitList(0x0000F000|EXLST_ADD, cleanup); … … 95 97 break; 96 98 case 1 : 97 UnregisterLxDll(hModule); 99 if(dllHandle) { 100 UnregisterLxDll(dllHandle); 101 } 98 102 break; 99 103 default : -
trunk/src/comctl32/initterm.cpp
r2647 r3993 1 /* $Id: initterm.cpp,v 1. 9 2000-02-05 01:53:54sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.10 2000-08-11 10:56:12 sandervl Exp $ */ 2 2 /* 3 3 * COMCTL32 DLL entry point … … 43 43 extern DWORD _Resource_PEResTab; 44 44 } 45 46 static HMODULE dllHandle = 0; 45 47 46 48 void CDECL RegisterCOMCTL32WindowClasses(unsigned long hinstDLL); … … 98 100 /*******************************************************************/ 99 101 100 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 102 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab, 103 COMCTL32_MAJORIMAGE_VERSION, COMCTL32_MINORIMAGE_VERSION, 104 IMAGE_SUBSYSTEM_WINDOWS_GUI); 105 if(dllHandle == 0) 101 106 return 0UL; 102 107 … … 104 109 105 110 /* register Win32 window classes implemented in this DLL */ 106 RegisterCOMCTL32WindowClasses( hModule);111 RegisterCOMCTL32WindowClasses(dllHandle); 107 112 108 113 break; 109 114 case 1 : 110 UnregisterLxDll(hModule); 115 if(dllHandle) { 116 UnregisterLxDll(dllHandle); 117 } 111 118 break; 112 119 default : -
trunk/src/comctl32/propsheet.cpp
r3912 r3993 1 /* $Id: propsheet.cpp,v 1. 5 2000-08-01 23:19:49sandervl Exp $ */1 /* $Id: propsheet.cpp,v 1.6 2000-08-11 10:56:12 sandervl Exp $ */ 2 2 /* 3 3 * Property Sheets … … 1068 1068 } 1069 1069 1070 #if 11070 #if 0 1071 1071 /****************************************************************************** 1072 1072 * PROPSHEET_ShowPage -
trunk/src/comdlg32/initterm.cpp
r2647 r3993 1 /* $Id: initterm.cpp,v 1. 9 2000-02-05 01:54:33 sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.10 2000-08-11 10:56:13 sandervl Exp $ */ 2 2 3 3 /* … … 46 46 BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved); 47 47 } 48 49 static HMODULE dllHandle = 0; 50 48 51 //****************************************************************************** 49 52 //****************************************************************************** … … 95 98 /*******************************************************************/ 96 99 97 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 100 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab, 101 COMDLG32_MAJORIMAGE_VERSION, COMDLG32_MINORIMAGE_VERSION, 102 IMAGE_SUBSYSTEM_WINDOWS_GUI); 103 if(dllHandle == 0) 98 104 return 0UL; 99 105 100 106 break; 101 107 case 1 : 102 UnregisterLxDll(hModule); 108 if(dllHandle) { 109 UnregisterLxDll(dllHandle); 110 } 103 111 break; 104 112 default : -
trunk/src/crtdll/initterm.cpp
r2650 r3993 1 /* $Id: initterm.cpp,v 1. 3 2000-02-05 01:55:11sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.4 2000-08-11 10:56:13 sandervl Exp $ */ 2 2 3 3 /* … … 47 47 BOOL WIN32API CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); 48 48 49 static HMODULE dllHandle = 0; 50 49 51 //****************************************************************************** 50 52 //****************************************************************************** … … 91 93 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 92 94 93 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 95 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 96 if(dllHandle == 0) 94 97 return 0UL; 95 98 96 99 break; 97 100 case 1 : 98 UnregisterLxDll(hModule); 101 if(dllHandle) { 102 UnregisterLxDll(dllHandle); 103 } 99 104 break; 100 105 -
trunk/src/ddraw/initterm.cpp
r2650 r3993 1 /* $Id: initterm.cpp,v 1.1 2 2000-02-05 01:55:52sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.13 2000-08-11 10:56:14 sandervl Exp $ */ 2 2 3 3 /* … … 46 46 47 47 char ddrawPath[CCHMAXPATH] = ""; 48 static HMODULE dllHandle = 0; 48 49 49 50 //****************************************************************************** … … 97 98 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 98 99 99 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 100 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab, 101 DDRAW_MAJORIMAGE_VERSION, DDRAW_MINORIMAGE_VERSION, 102 IMAGE_SUBSYSTEM_WINDOWS_GUI); 103 if(dllHandle == 0) 100 104 return 0UL; 101 105 … … 103 107 } 104 108 case 1 : 105 UnregisterLxDll(hModule); 109 if(dllHandle) { 110 UnregisterLxDll(dllHandle); 111 } 106 112 break; 107 113 default : -
trunk/src/dllentry/dllentry.cpp
r2644 r3993 1 /* $Id: dllentry.cpp,v 1. 1 2000-02-05 01:49:48sandervl Exp $ */1 /* $Id: dllentry.cpp,v 1.2 2000-08-11 10:56:14 sandervl Exp $ */ 2 2 3 3 /* … … 44 44 extern DWORD _Resource_PEResTab; 45 45 } 46 47 static HMODULE dllHandle = 0; 48 46 49 //****************************************************************************** 47 50 //****************************************************************************** … … 84 87 85 88 switch (ulFlag) { 86 case 0 89 case 0: 87 90 _ctordtorInit(); 88 91 89 92 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 90 93 91 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 94 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 95 if(dllHandle == 0) 92 96 return 0UL; 93 97 94 98 break; 95 case 1 : 96 UnregisterLxDll(hModule); 99 case 1: 100 if(dllHandle) { 101 UnregisterLxDll(dllHandle); 102 } 97 103 break; 98 default 104 default: 99 105 return 0UL; 100 106 } -
trunk/src/dsound/initterm.cpp
r3099 r3993 1 /* $Id: initterm.cpp,v 1.1 0 2000-03-13 12:47:52sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.11 2000-08-11 10:56:15 sandervl Exp $ */ 2 2 3 3 /* … … 46 46 47 47 char dsoundPath[CCHMAXPATH] = ""; 48 static char dllHandle = 0; 48 49 49 50 //****************************************************************************** … … 96 97 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 97 98 98 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 99 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 100 if(dllHandle == 0) 99 101 return 0UL; 100 102 101 103 break; 102 104 } 105 103 106 case 1 : 104 UnregisterLxDll(hModule); 107 if(dllHandle) { 108 UnregisterLxDll(dllHandle); 109 } 105 110 break; 106 111 default : -
trunk/src/gdi32/initterm.cpp
r3705 r3993 1 /* $Id: initterm.cpp,v 1.1 1 2000-06-14 13:17:50sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.12 2000-08-11 10:56:15 sandervl Exp $ */ 2 2 3 3 /* … … 47 47 extern DWORD _Resource_PEResTab; 48 48 } 49 static HMODULE dllHandle = 0; 49 50 //****************************************************************************** 50 51 //****************************************************************************** … … 100 101 if(InitRegionSpace() == FALSE) { 101 102 return 0UL; 102 } 103 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 103 } 104 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab, 105 GDI32_MAJORIMAGE_VERSION, GDI32_MINORIMAGE_VERSION, 106 IMAGE_SUBSYSTEM_NATIVE); 107 if(dllHandle == 0) 104 108 return 0UL; 105 109 106 110 break; 107 111 case 1 : 108 UnregisterLxDll(hModule); 112 if(dllHandle) { 113 UnregisterLxDll(dllHandle); 114 } 109 115 break; 110 116 default : -
trunk/src/imagehlp/initterm.cpp
r2650 r3993 1 /* $Id: initterm.cpp,v 1. 3 2000-02-05 02:00:05 sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.4 2000-08-11 10:56:15 sandervl Exp $ */ 2 2 3 3 /* … … 44 44 extern DWORD _Resource_PEResTab; 45 45 } 46 static HMODULE dllHandle = 0; 46 47 47 48 BOOL WINAPI IMAGEHLP_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); … … 91 92 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 92 93 93 /*******************************************************************/ 94 /* A DosExitList routine must be used to clean up if runtime calls */ 95 /* are required and the runtime is dynamically linked. */ 96 /*******************************************************************/ 97 98 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 94 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 95 if(dllHandle == 0) 99 96 return 0UL; 100 97 101 98 break; 102 99 case 1 : 103 UnregisterLxDll(hModule); 100 if(dllHandle) { 101 UnregisterLxDll(dllHandle); 102 } 104 103 break; 105 104 -
trunk/src/kernel32/KERNEL32.DEF
r3846 r3993 1 ; $Id: KERNEL32.DEF,v 1.8 4 2000-07-18 17:34:07 birdExp $1 ; $Id: KERNEL32.DEF,v 1.85 2000-08-11 10:56:16 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 1035 1035 1036 1036 _RegisterLxExe@8 @1237 1037 _RegisterLxDll@ 12@12381037 _RegisterLxDll@24 @1238 1038 1038 _UnregisterLxDll@4 @1239 1039 1039 -
trunk/src/kernel32/initterm.cpp
r3740 r3993 1 /* $Id: initterm.cpp,v 1.4 3 2000-06-21 20:51:52sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.44 2000-08-11 10:56:16 sandervl Exp $ */ 2 2 3 3 /* … … 81 81 int loadNr = 0; 82 82 char kernel32Path[CCHMAXPATH] = ""; 83 static HMODULE dllHandle = 0; 83 84 84 85 /****************************************************************************/ … … 128 129 129 130 PROFILE_LoadOdinIni(); 130 if(RegisterLxDll(hModule, 0, (PVOID)&_Resource_PEResTab) == FALSE) 131 dllHandle = RegisterLxDll(hModule, 0, (PVOID)&_Resource_PEResTab); 132 if(dllHandle == 0) 131 133 return 0UL; 132 134 133 135 //SvL: Kernel32 is a special case; pe.exe loads it, so increase 134 136 // the reference count here 135 Win32DllBase *module = Win32DllBase::findModule( hModule);137 Win32DllBase *module = Win32DllBase::findModule(dllHandle); 136 138 if(module) { 137 139 module->AddRef(); … … 178 180 } 179 181 case 1 : 180 UnregisterLxDll(hModule); 182 if(dllHandle) { 183 UnregisterLxDll(dllHandle); 184 } 181 185 break; 182 186 default : -
trunk/src/kernel32/misc.cpp
r3889 r3993 1 /* $Id: misc.cpp,v 1.2 4 2000-07-22 12:52:45sandervl Exp $ */1 /* $Id: misc.cpp,v 1.25 2000-08-11 10:56:16 sandervl Exp $ */ 2 2 3 3 /* … … 30 30 #include "logging.h" 31 31 #include <wprocess.h> 32 #include <versionos2.h> 32 33 33 34 /***************************************************************************** -
trunk/src/kernel32/oslibdos.cpp
r3976 r3993 1 /* $Id: oslibdos.cpp,v 1.3 6 2000-08-10 02:19:58 phallerExp $ */1 /* $Id: oslibdos.cpp,v 1.37 2000-08-11 10:56:17 sandervl Exp $ */ 2 2 /* 3 3 * Wrappers for OS/2 Dos* API … … 930 930 rc = OdinDosSetFileLocksL(hFile, NULL, &lockRangeL, 931 931 (dwFlags & LOCKFILE_FAIL_IMMEDIATELY_W) ? 0 : 5000, 0); 932 //SvL: 64 bits values are only supported by JFS 933 // Try the 32 bits DosSetFileLocks if it fails 934 // (TODO: should check the partition type instead) 935 if(rc == ERROR_INVALID_PARAMETER && (OffsetHigh || nNumberOfBytesToLockHigh)) { 936 goto oldlock; 937 } 932 938 } 933 939 else 934 940 { 941 oldlock: 935 942 FILELOCK lockRange = { OffsetLow, nNumberOfBytesToLockLow }; 936 943 … … 969 976 970 977 rc = OdinDosSetFileLocksL(hFile, &unlockRangeL, NULL, 5000, 0); 978 //SvL: 64 bits values are only supported by JFS 979 // Try the 32 bits DosSetFileLocks if it fails 980 // (TODO: should check the partition type instead) 981 if(rc == ERROR_INVALID_PARAMETER && (OffsetHigh || nNumberOfBytesToLockHigh)) { 982 goto oldlock; 983 } 971 984 } 972 985 else 973 986 { 987 oldlock: 974 988 FILELOCK unlockRange = { OffsetLow, nNumberOfBytesToLockLow }; 975 989 -
trunk/src/kernel32/oslibmisc.cpp
r3501 r3993 1 /* $Id: oslibmisc.cpp,v 1. 9 2000-05-09 18:56:09sandervl Exp $ */1 /* $Id: oslibmisc.cpp,v 1.10 2000-08-11 10:56:18 sandervl Exp $ */ 2 2 /* 3 3 * Misc OS/2 util. procedures … … 40 40 } 41 41 //****************************************************************************** 42 /***************************************************************************** 42 //****************************************************************************** 43 BOOL OSLibGetDllName(ULONG hModule, char *name, int length) 44 { 45 return DosQueryModuleName(hModule, length, name) == 0; 46 } 47 //****************************************************************************** 48 /****************************************************************************** 43 49 * Name : ULONG OSLibiGetModuleHandleA 44 50 * Purpose : replacement for IBM Open32's GetModuleHandle -
trunk/src/kernel32/oslibmisc.h
r3746 r3993 1 /* $Id: oslibmisc.h,v 1. 5 2000-06-23 19:02:38 sandervl Exp $ */1 /* $Id: oslibmisc.h,v 1.6 2000-08-11 10:56:18 sandervl Exp $ */ 2 2 /* 3 3 * Misc util. procedures … … 12 12 13 13 char *OSLibGetDllName(ULONG hModule); 14 BOOL OSLibGetDllName(ULONG hModule, char *name, int length); 14 15 15 16 char *OSLibStripPath(char *path); -
trunk/src/kernel32/windllbase.cpp
r3854 r3993 1 /* $Id: windllbase.cpp,v 1.1 5 2000-07-18 18:37:29sandervl Exp $ */1 /* $Id: windllbase.cpp,v 1.16 2000-08-11 10:56:18 sandervl Exp $ */ 2 2 3 3 /* … … 53 53 referenced(0), fSkipThreadEntryCalls(FALSE), next(NULL), fInserted(FALSE), 54 54 fAttachedToProcess(FALSE), fUnloaded(FALSE), 55 nrDynamicLibRef(0), f LoadLibrary(FALSE), fDisableUnload(FALSE)55 nrDynamicLibRef(0), fDisableUnload(FALSE) 56 56 { 57 57 dllEntryPoint = DllEntryPoint; … … 89 89 } 90 90 dlllistmutex.leave(); 91 }92 //******************************************************************************93 //******************************************************************************94 void Win32DllBase::loadLibrary()95 {96 //dummy97 91 } 98 92 //****************************************************************************** -
trunk/src/kernel32/windllbase.h
r3854 r3993 1 /* $Id: windllbase.h,v 1. 4 2000-07-18 18:37:29sandervl Exp $ */1 /* $Id: windllbase.h,v 1.5 2000-08-11 10:56:18 sandervl Exp $ */ 2 2 3 3 /* … … 86 86 BOOL RemoveCircularDependency(Win32DllBase *parent); 87 87 88 // Loaded by DosLoadModule89 virtual void setLoadLibrary() { fLoadLibrary = TRUE; };90 91 // isLoaded returns TRUE when a dll has been loaded with DosLoadModule92 virtual BOOL isLoaded() { return fLoadLibrary; };93 94 //Should only be called to make sure DosLoadModule is called at least95 //once for a dll (to make sure OS/2 doesn't unload the dll when it's96 //still needed)97 virtual void loadLibrary();98 99 88 //Only called for kernel32 100 89 void DisableUnload() { fDisableUnload = TRUE; }; … … 138 127 139 128 //This flag is set when a dll has been loaded with DosLoadModule 140 BOOL fLoadLibrary;141 129 BOOL fDisableUnload; 142 130 131 static Win32DllBase *head; 132 Win32DllBase *next; 143 133 private: 144 134 static Queue loadLibDlls; 145 static Win32DllBase *head;146 Win32DllBase *next;147 135 }; 148 136 -
trunk/src/kernel32/windlllx.cpp
r3854 r3993 1 /* $Id: windlllx.cpp,v 1.1 1 2000-07-18 18:37:29sandervl Exp $ */1 /* $Id: windlllx.cpp,v 1.12 2000-08-11 10:56:18 sandervl Exp $ */ 2 2 3 3 /* … … 42 42 //Create LX Dll object and send process attach message 43 43 //System dlls set EntryPoint to 0 44 //Parameters: 45 // HINSTANCE hInstance - OS/2 module handle 46 // WIN32DLLENTRY EntryPoint - Win32 dll entrypoint address 47 // PVOID pResData - pointer to win32 resource data 48 // DWORD MajorImageVersion - major image/os version (for fake win32 header) 49 // DWORD MinorImageVersion - minor image/os version (for fake win32 header) 50 // DWORD Subsystem - subsystem type (for fake win32 header) 51 // (IMAGE_SUBSYSTEM_WINDOWS_CUI/IMAGE_SUBSYSTEM_WINDOWS_GUI) 52 // 44 53 //Returns: Odin32 module handle 45 54 //****************************************************************************** 46 55 DWORD WIN32API RegisterLxDll(HINSTANCE hInstance, WIN32DLLENTRY EntryPoint, 47 PVOID pResData) 48 { 49 Win32LxDll *windll; 56 PVOID pResData, 57 DWORD MajorImageVersion, 58 DWORD MinorImageVersion, 59 DWORD Subsystem) 60 { 61 APIRET rc; 62 Win32LxDll *windll; 50 63 Win32DllBase *windlldep; 51 52 windll = (Win32LxDll *)Win32DllBase::findModule(hInstance); 53 if(windll) { 54 char *name = OSLibGetDllName(hInstance); 55 dprintf(("RegisterLxDll: Register existing dll %x %s", hInstance, name)); 56 return FALSE; 57 } 58 windll = new Win32LxDll(hInstance, EntryPoint, pResData); 64 char szFileName[CCHMAXPATH], szErrName[CCHMAXPATH]; 65 66 if(OSLibGetDllName(hInstance, szFileName, sizeof(szFileName)) == FALSE) { 67 dprintf(("ERROR: RegisterLxDll: OSLibGetDllName %x failed!!", hInstance)); 68 return 0; 69 } 70 //Make sure DosLoadModule is called at least 71 //once for a dll (to make sure OS/2 doesn't unload the dll when it's 72 //still needed) 73 rc = DosLoadModule(szErrName, sizeof(szErrName), szFileName, &hInstance); 74 if(rc != 0) { 75 dprintf(("ERROR: RegisterLxDll: DosLoadModule %s failed (rc=%d)!!", szFileName, rc)); 76 return 0; 77 } 78 windll = new Win32LxDll(hInstance, EntryPoint, pResData, MajorImageVersion, 79 MinorImageVersion, Subsystem); 59 80 if(windll == NULL) { 60 81 dprintf(("RegisterLxDll: windll == NULL!!!")); 61 return FALSE;82 return 0; 62 83 } 63 84 if(!fPeLoader) { … … 74 95 char modulename[CCHMAXPATH]; 75 96 char modsize; 76 APIRET rc;77 97 int i; 78 98 … … 118 138 BOOL WIN32API UnregisterLxDll(HINSTANCE hInstance) 119 139 { 120 Win32 LxDll*windll;140 Win32DllBase *windll; 121 141 122 142 //Don't proceed for pe2lx/win32k (os/2 dll unload dependency bug) … … 125 145 return TRUE; 126 146 127 windll = (Win32LxDll *)Win32DllBase::findModule(hInstance);147 windll = Win32DllBase::findModule(hInstance); 128 148 if(!windll) { 129 149 dprintf(("UnregisterLxDll: Can't find dll with handle %x (already deleted)", hInstance)); … … 137 157 //****************************************************************************** 138 158 //****************************************************************************** 139 Win32LxDll::Win32LxDll(HINSTANCE hInstance, WIN32DLLENTRY EntryPoint, PVOID pResData) 159 Win32LxDll::Win32LxDll(HINSTANCE hInstance, WIN32DLLENTRY EntryPoint, PVOID pResData, 160 DWORD MajorImageVersion, DWORD MinorImageVersion, 161 DWORD Subsystem) 140 162 : Win32ImageBase(hInstance), 141 163 Win32LxImage(hInstance, pResData), … … 146 168 fAttachedToProcess = TRUE; 147 169 } 170 hinstanceOS2 = hInstance; 171 //new win32 instance handle must be pointer to PE header 172 hinstance = (HINSTANCE)buildHeader(MajorImageVersion, MinorImageVersion, 173 Subsystem); 148 174 } 149 175 //****************************************************************************** … … 151 177 Win32LxDll::~Win32LxDll() 152 178 { 153 }154 //******************************************************************************155 //Load it again so OS/2 takes care of the reference count (to make sure156 //a dll isn't unloaded when the win32 app still needs it)157 //******************************************************************************158 void Win32LxDll::loadLibrary()159 {160 char szModuleFailure[CCHMAXPATH] = "";161 ULONG hInstanceNewDll;162 APIRET rc;163 164 if(fLoadLibrary) {165 DebugInt3();166 return;167 }168 169 dprintf(("Win32LxDll::loadLibrary %s", getModuleName()));170 rc = DosLoadModule(szModuleFailure, sizeof(szModuleFailure), getFullPath(), (HMODULE *)&hInstanceNewDll);171 if(rc) {172 dprintf(("DosLoadModule returned %X for %s\n", rc, szModuleFailure));173 DebugInt3(); //should NEVER happen174 return;175 }176 //only do this once, so set the fLoadLibrary flag to true177 setLoadLibrary();178 179 } 179 180 //****************************************************************************** … … 227 228 ULONG ret; 228 229 APIRET rc; 229 BOOL fLoadLib = fLoadLibrary; 230 231 if(fDisableUnload) {//only set for kernel32.dll 232 fLoadLib = FALSE; 233 } 234 hinst = hinstance; 230 231 hinst = hinstanceOS2; 235 232 ret = Win32DllBase::Release(); 236 if(ret == 0 && fLoadLib) {233 if(ret == 0 && !fDisableUnload) {//only set for kernel32.dll (fDisableUnload) 237 234 //DosFreeModule sends a termination message to the dll. 238 235 //The LX dll informs us when it's removed (UnregisterDll call) … … 252 249 //****************************************************************************** 253 250 //****************************************************************************** 251 void Win32LxDll::setDllHandleOS2(HINSTANCE hInstanceOS2) 252 { 253 //Loaded with LoadLibrary(Ex); no need for a 2nd DosLoadModule 254 //Dlls that are indirectly loaded (i.e. GDI32->KERNEL32 dependancy) need 255 //this additional DosLoadModule (and setDllHandleOS2 isn't called for those) 256 if(this->hinstanceOS2) { 257 DosFreeModule(this->hinstanceOS2); 258 } 259 this->hinstanceOS2 = hInstanceOS2; 260 } 261 //****************************************************************************** 262 //****************************************************************************** 263 Win32LxDll *Win32LxDll::findModuleByOS2Handle(HINSTANCE hinstance) 264 { 265 dlllistmutex.enter(); 266 267 Win32LxDll *mod = (Win32LxDll*)Win32DllBase::head; 268 while(mod != NULL) { 269 dbgCheckObj(mod); 270 if(mod->isLxDll() && mod->hinstanceOS2 == hinstance) { 271 dlllistmutex.leave(); 272 return(mod); 273 } 274 mod = (Win32LxDll*)mod->next; 275 } 276 dlllistmutex.leave(); 277 return(NULL); 278 } 279 //****************************************************************************** 280 //****************************************************************************** -
trunk/src/kernel32/windlllx.h
r3059 r3993 1 /* $Id: windlllx.h,v 1. 1 2000-03-09 19:03:21sandervl Exp $ */1 /* $Id: windlllx.h,v 1.2 2000-08-11 10:56:19 sandervl Exp $ */ 2 2 3 3 /* … … 19 19 { 20 20 public: 21 Win32LxDll(HINSTANCE hInstance, WIN32DLLENTRY DllEntryPoint, PVOID pResData); 21 Win32LxDll(HINSTANCE hInstance, WIN32DLLENTRY DllEntryPoint, PVOID pResData, 22 DWORD MajorImageVersion, DWORD MinorImageVersion, 23 DWORD Subsystem); 22 24 virtual ~Win32LxDll(); 23 25 … … 29 31 virtual ULONG Release(); 30 32 31 // Loaded by DosLoadModule (only relevant for LX dlls) 32 virtual void setLoadLibrary() { fLoadLibrary = TRUE; }; 33 34 // isLoaded returns TRUE when a dll has been loaded with DosLoadModule 35 virtual BOOL isLoaded() { return fLoadLibrary; }; 36 37 //Should only be called to make sure DosLoadModule is called at least 38 //once for a dll (to make sure OS/2 doesn't unload the dll when it's 39 //still needed) 40 virtual void loadLibrary(); 33 void setDllHandleOS2(HINSTANCE hInstanceOS2); 41 34 42 35 virtual BOOL isLxDll(); 36 37 static Win32LxDll *findModuleByOS2Handle(HINSTANCE hinstance); 43 38 44 39 protected: -
trunk/src/kernel32/windllpe2lx.cpp
r3059 r3993 1 /* $Id: windllpe2lx.cpp,v 1. 7 2000-03-09 19:03:21sandervl Exp $ */1 /* $Id: windllpe2lx.cpp,v 1.8 2000-08-11 10:56:19 sandervl Exp $ */ 2 2 3 3 /* … … 116 116 else 117 117 { /* process detach */ 118 if (pWinMod != NULL && !fFreeLibrary)118 if (pWinMod != NULL) 119 119 return 0; /* don't unload (OS/2 dll unload bug) - see OS2.bugs in root dir. */ 120 120 } -
trunk/src/kernel32/winimagelx.cpp
r3765 r3993 1 /* $Id: winimagelx.cpp,v 1. 8 2000-06-28 18:08:35sandervl Exp $ */1 /* $Id: winimagelx.cpp,v 1.9 2000-08-11 10:56:19 sandervl Exp $ */ 2 2 3 3 /* 4 4 * Win32 LX Image base class 5 5 * 6 * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)6 * Copyright 1999-2000 Sander van Leeuwen (sandervl@xs4all.nl) 7 7 * 8 * TODO: headers not complete 9 * 8 10 * Project Odin Software License can be found in LICENSE.TXT 9 11 * … … 40 42 #include "dbglocal.h" 41 43 44 static BYTE dosHeader[] = { 45 0x4D, 0x5A, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x0B, 0x00, 46 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 47 0x6A, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 49 0xB4, 0x30, 0xCD, 0x21, 0x86, 0xC4, 0x3D, 0x0A, 0x14, 0x72, 0x42, 0xBE, 0x80, 0x00, 0x8A, 0x1C, 50 0x32, 0xFF, 0x46, 0x88, 0x38, 0x2E, 0x8C, 0x1E, 0x6E, 0x00, 0x8E, 0x06, 0x2C, 0x00, 0x33, 0xC0, 51 0x8B, 0xF8, 0xB9, 0x00, 0x80, 0xFC, 0xF2, 0xAE, 0x75, 0x23, 0x49, 0x78, 0x20, 0xAE, 0x75, 0xF6, 52 0x47, 0x47, 0x0E, 0x1F, 0x2E, 0x89, 0x3E, 0x68, 0x00, 0x2E, 0x8C, 0x06, 0x6A, 0x00, 0xBE, 0x5C, 53 0x00, 0xB9, 0x6C, 0x63, 0xBB, 0x25, 0x00, 0xB4, 0x64, 0xCD, 0x21, 0x73, 0x0B, 0xBA, 0x7C, 0x00, 54 0x0E, 0x1F, 0xB4, 0x09, 0xCD, 0x21, 0xB0, 0x01, 0xB4, 0x4C, 0xCD, 0x21, 0x20, 0x00, 0x01, 0x00, 55 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 56 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x54, 0x68, 0x69, 0x73, 57 0x20, 0x70, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x20, 0x6D, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 58 0x20, 0x72, 0x75, 0x6E, 0x20, 0x75, 0x6E, 0x64, 0x65, 0x72, 0x20, 0x57, 0x69, 0x6E, 0x33, 0x32, 59 0x2E, 0x0D, 0x0A, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 60 }; 61 42 62 //****************************************************************************** 43 63 //****************************************************************************** 44 64 Win32LxImage::Win32LxImage(HINSTANCE hInstance, PVOID pResData) 45 : Win32ImageBase(hInstance) 65 : Win32ImageBase(hInstance), header(0) 46 66 { 47 67 APIRET rc; … … 67 87 Win32LxImage::~Win32LxImage() 68 88 { 89 if(header) { 90 DosFreeMem(header); 91 } 69 92 } 70 93 //****************************************************************************** … … 75 98 ULONG apiaddr; 76 99 77 rc = DosQueryProcAddr(hinstance , 0, name, (PFN *)&apiaddr);100 rc = DosQueryProcAddr(hinstanceOS2, 0, name, (PFN *)&apiaddr); 78 101 if(rc) 79 102 { 80 if(rc == ERROR_INVALID_HANDLE) 81 {//handle invalid for some silly reason, so load module again (initterm entrypoint not called twice) 82 char szErrName[CCHMAXPATH]; 83 84 rc = DosLoadModule(szErrName, sizeof(szErrName), szFileName, &hinstance); 85 if(!rc) 86 rc = DosQueryProcAddr(hinstance, 0, name, (PFN *)&apiaddr); 87 } 88 if(rc) return(0); 103 dprintf(("Win32LxImage::getApi -> rc = %d", rc)); 104 return(0); 89 105 } 90 106 return(apiaddr); … … 97 113 ULONG apiaddr; 98 114 99 rc = DosQueryProcAddr(hinstance , ordinal, NULL, (PFN *)&apiaddr);115 rc = DosQueryProcAddr(hinstanceOS2, ordinal, NULL, (PFN *)&apiaddr); 100 116 if(rc) { 101 if(rc == ERROR_INVALID_HANDLE) 102 {//SvL(?): handle invalid for some silly reason, so load module again (initterm entrypoint not called twice) 103 //KSO: AFAIK you'll have to load the module calling DosLoadModule to use it's handle in API calls. 104 // CPREF->DosGetResource->hmod: ... A value other than zero is a module handle that was returned by DosLoadModule. 105 // You may consider adding a DosLoadModule call during RegisterLxDll or somewhere. 106 char szErrName[CCHMAXPATH]; 107 108 rc = DosLoadModule(szErrName, sizeof(szErrName), szFileName, &hinstance); 109 if(!rc) 110 rc = DosQueryProcAddr(hinstance, ordinal, NULL, (PFN *)&apiaddr); 111 } 112 if(rc) return(0); 117 dprintf(("Win32LxImage::getApi -> rc = %d", rc)); 118 return(0); 113 119 } 114 120 return(apiaddr); … … 116 122 //****************************************************************************** 117 123 //****************************************************************************** 124 LPVOID Win32LxImage::buildHeader(DWORD MajorImageVersion, DWORD MinorImageVersion, 125 DWORD Subsystem) 126 { 127 APIRET rc; 128 IMAGE_DOS_HEADER *pdosheader; 129 PIMAGE_OPTIONAL_HEADER poh; 130 PIMAGE_FILE_HEADER pfh; 131 DWORD *ntsig; 118 132 133 rc = DosAllocMem(&header, 4096, PAG_READ | PAG_WRITE | PAG_COMMIT); 134 if(rc) { 135 dprintf(("ERROR: buildHeader DosAllocMem failed!! (rc=%x)", rc)); 136 DebugInt3(); 137 return NULL; 138 } 139 memcpy(header, dosHeader, sizeof(dosHeader)); 140 ntsig = (DWORD *)((LPBYTE)header + sizeof(dosHeader)); 141 *ntsig = IMAGE_NT_SIGNATURE; 142 pfh = (PIMAGE_FILE_HEADER)(ntsig+1); 143 pfh->Machine = IMAGE_FILE_MACHINE_I386; 144 pfh->NumberOfSections = 0; 145 pfh->TimeDateStamp = 0x3794f60f; 146 pfh->PointerToSymbolTable = 0; 147 pfh->NumberOfSymbols = 0; 148 pfh->SizeOfOptionalHeader = sizeof(IMAGE_OPTIONAL_HEADER); 149 pfh->Characteristics = IMAGE_FILE_DLL | IMAGE_FILE_32BIT_MACHINE | 150 IMAGE_FILE_DEBUG_STRIPPED | IMAGE_FILE_EXECUTABLE_IMAGE | 151 IMAGE_FILE_RELOCS_STRIPPED; 152 poh = (PIMAGE_OPTIONAL_HEADER)(pfh+1); 153 poh->Magic = IMAGE_NT_OPTIONAL_HDR_MAGIC; 154 poh->MajorLinkerVersion = 0x3; 155 poh->MinorLinkerVersion = 0xA; 156 poh->SizeOfCode = 0; 157 poh->SizeOfInitializedData = 0; 158 poh->SizeOfUninitializedData = 0; 159 poh->AddressOfEntryPoint = 0; 160 poh->BaseOfCode = 0; 161 poh->BaseOfData = 0; 162 poh->ImageBase = 0; 163 poh->SectionAlignment = 4096; 164 poh->FileAlignment = 512; 165 poh->MajorOperatingSystemVersion = MajorImageVersion; 166 poh->MinorOperatingSystemVersion = MinorImageVersion; 167 poh->MajorImageVersion = MajorImageVersion; 168 poh->MinorImageVersion = MinorImageVersion; 169 poh->MajorSubsystemVersion = ODINNT_MAJOR_VERSION; 170 poh->MinorSubsystemVersion = ODINNT_MINOR_VERSION; 171 poh->Reserved1 = 0; 172 poh->SizeOfImage = 0; 173 poh->SizeOfHeaders = 1024; 174 poh->CheckSum = 0; 175 poh->Subsystem = Subsystem; 176 poh->DllCharacteristics = 0; 177 poh->SizeOfStackReserve = 1*1024*1024; 178 poh->SizeOfStackCommit = 4096; 179 poh->SizeOfHeapReserve = 1*1024*1024; 180 poh->SizeOfHeapCommit = 4096; 181 poh->LoaderFlags = 0; 182 poh->NumberOfRvaAndSizes = 0; 183 // poh->DataDirectory[0] 184 185 return header; 186 } 187 //****************************************************************************** 188 //****************************************************************************** -
trunk/src/kernel32/winimagelx.h
r3074 r3993 1 /* $Id: winimagelx.h,v 1. 1 2000-03-10 16:12:03sandervl Exp $ */1 /* $Id: winimagelx.h,v 1.2 2000-08-11 10:56:19 sandervl Exp $ */ 2 2 3 3 /* … … 24 24 virtual ULONG getApi(int ordinal); 25 25 26 LPVOID buildHeader(DWORD MajorImageVersion, DWORD MinorImageVersion, 27 DWORD Subsystem); 28 26 29 protected: 30 LPVOID header; 31 HINSTANCE hinstanceOS2; 27 32 private: 28 33 }; -
trunk/src/kernel32/winimagepeldr.cpp
r3948 r3993 1 /* $Id: winimagepeldr.cpp,v 1.5 1 2000-08-04 21:12:10sandervl Exp $ */1 /* $Id: winimagepeldr.cpp,v 1.52 2000-08-11 10:56:19 sandervl Exp $ */ 2 2 3 3 /* … … 42 42 #include "winimagepeldr.h" 43 43 #include "windllpeldr.h" 44 #include "windlllx.h" 44 45 #include <pefile.h> 45 46 #include <unicode.h> … … 1218 1219 ULONG ulCurFixup; 1219 1220 int Size; 1220 Win32 PeLdrDll*WinDll;1221 Win32DllBase *WinDll; 1221 1222 Section *section; 1222 1223 … … 1335 1336 dprintf((LOG, "************** Import Module %s ", pszCurModule )); 1336 1337 dprintf((LOG, "**********************************************************************" )); 1337 WinDll = (Win32PeLdrDll *)Win32DllBase::findModule(pszCurModule);1338 WinDll = Win32DllBase::findModule(pszCurModule); 1338 1339 1339 1340 if(WinDll == NULL) … … 1350 1351 char szModuleFailure[CCHMAXPATH] = ""; 1351 1352 ULONG hInstanceNewDll; 1353 Win32LxDll *lxdll; 1352 1354 1353 1355 char *dot = strchr(modname, '.'); … … 1363 1365 return(FALSE); 1364 1366 } 1365 WinDll = (Win32PeLdrDll *)Win32DllBase::findModule(hInstanceNewDll);1366 if( WinDll == NULL) {//shouldn't happen!1367 lxdll = Win32LxDll::findModuleByOS2Handle(hInstanceNewDll); 1368 if(lxdll == NULL) {//shouldn't happen! 1367 1369 dprintf((LOG, "Just loaded the dll, but can't find it anywhere?!!?")); 1368 1370 errorState = ERROR_INTERNAL; 1369 1371 return(FALSE); 1370 1372 } 1371 //Mark this dll as loaded by DosLoadModule1372 WinDll->setLoadLibrary();1373 WinDll->AddRef();1373 lxdll->setDllHandleOS2(hInstanceNewDll); 1374 lxdll->AddRef(); 1375 WinDll = (Win32DllBase*)lxdll; 1374 1376 } 1375 1377 else { 1376 WinDll = new Win32PeLdrDll(modname, this); 1377 1378 if(WinDll == NULL) { 1379 dprintf((LOG, "WinDll: Error allocating memory" )); 1378 Win32PeLdrDll *pedll; 1379 1380 pedll = new Win32PeLdrDll(modname, this); 1381 if(pedll == NULL) { 1382 dprintf((LOG, "pedll: Error allocating memory" )); 1380 1383 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szMemErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE); 1381 1384 errorState = ERROR_INTERNAL; … … 1385 1388 dprintf((LOG, "********************** Loading Module *********************" )); 1386 1389 dprintf((LOG, "**********************************************************************" )); 1387 if( WinDll->init(0) == FALSE) {1388 dprintf((LOG, "Internal WinDll error ", WinDll->getError() ));1390 if(pedll->init(0) == FALSE) { 1391 dprintf((LOG, "Internal WinDll error ", pedll->getError() )); 1389 1392 return(FALSE); 1390 1393 } 1391 1394 #ifdef DEBUG 1392 WinDll->AddRef(getModuleName());1395 pedll->AddRef(getModuleName()); 1393 1396 #else 1394 WinDll->AddRef();1397 pedll->AddRef(); 1395 1398 #endif 1396 if( WinDll->attachProcess() == FALSE) {1399 if(pedll->attachProcess() == FALSE) { 1397 1400 dprintf((LOG, "attachProcess failed!" )); 1398 delete WinDll;1401 delete pedll; 1399 1402 errorState = ERROR_INTERNAL; 1400 1403 return(FALSE); 1401 1404 } 1405 WinDll = (Win32DllBase*)pedll; 1402 1406 } 1403 1407 … … 1407 1411 } 1408 1412 else { 1409 if(WinDll->isLxDll() && !WinDll->isLoaded()) {1410 //can happen with i.e. wininet1411 //wininet depends on wsock32; when the app loads wsock32 afterwards1412 //with LoadLibrary or as a child of another dll, we need to make1413 //sure it's loaded once with DosLoadModule1414 WinDll->loadLibrary();1415 }1416 1413 WinDll->AddRef(); 1417 1414 … … 1419 1416 } 1420 1417 //add the dll we just loaded to dependency list for this image 1421 addDependency( (Win32DllBase *)WinDll);1418 addDependency(WinDll); 1422 1419 1423 1420 //Make sure the dependency list is correct (already done -
trunk/src/kernel32/wprocess.cpp
r3975 r3993 1 /* $Id: wprocess.cpp,v 1.8 5 2000-08-09 18:59:03sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.86 2000-08-11 10:56:20 sandervl Exp $ */ 2 2 3 3 /* … … 25 25 #include "winexepeldr.h" 26 26 #include "winfakepeldr.h" 27 #include "windlllx.h" 27 28 #include <vmutex.h> 28 29 #include <handlemanager.h> … … 51 52 //****************************************************************************** 52 53 //****************************************************************************** 53 BOOL fFreeLibrary = FALSE;54 54 BOOL fIsOS2Image = FALSE; //TRUE -> Odin32 OS/2 application (not converted!) 55 55 //FALSE -> otherwise … … 448 448 return(TRUE); 449 449 } 450 dprintf(("KERNEL32: FreeLibrary %s %X\n", OSLibGetDllName(hinstance), hinstance)); 451 452 //TODO: Not thread safe 453 fFreeLibrary = TRUE; //ditch dll 454 rc = O32_FreeLibrary(hinstance); 455 fFreeLibrary = FALSE; 456 dprintf(("FreeLibrary returned %X\n", rc)); 450 dprintf(("WARNING: KERNEL32: FreeLibrary %s %x NOT FOUND!", OSLibGetDllName(hinstance), hinstance)); 457 451 return(TRUE); 458 452 } … … 707 701 if (pModule) 708 702 { 709 if (pModule->isLxDll() && !pModule->isLoaded() && fPeLoader)710 {711 //can happen with i.e. wininet712 //wininet depends on wsock32; when the app loads wsock32 afterwards713 //with LoadLibrary or as a child of another dll, we need to make714 //sure it's loaded once with DosLoadModule715 pModule->setLoadLibrary();716 }717 703 pModule->incDynamicLib(); 718 704 pModule->AddRef(); … … 771 757 { 772 758 /* OS/2 dll, system dll, converted dll or win32k took care of it.*/ 773 pModule = Win32DllBase::findModule(hDll);774 if 759 pModule = (Win32DllBase *)Win32LxDll::findModuleByOS2Handle(hDll); 760 if(pModule) 775 761 { 776 if (pModule->isLxDll() && fPeLoader) 762 763 if(pModule->isLxDll()) 777 764 { 778 pModule->setLoadLibrary(); 779 pModule->AddRef(); 765 ((Win32LxDll *)pModule)->setDllHandleOS2(hDll); 766 if(fPeLoader) { 767 pModule->AddRef(); 768 } 780 769 } 781 770 pModule->incDynamicLib(); 782 771 } 772 else { 773 return hDll; //happens when LoadLibrary is called in kernel32's initterm (nor harmful) 774 } 783 775 dprintf(("KERNEL32: LoadLibraryExA(%s, 0x%x, 0x%x): returns 0x%x. Loaded %s using O32_LoadLibrary.", 784 776 lpszLibFile, hFile, dwFlags, hDll, szModname)); 785 return hDll;777 return pModule->getInstanceHandle(); 786 778 } 787 779 dprintf(("KERNEL32: LoadLibraryExA(%s, 0x%x, 0x%x): O32_LoadLibrary(%s) failed. LastError=%d", … … 1099 1091 lpszPath[rc-1] = 0; 1100 1092 } 1093 //only needed for call inside kernel32's initterm (profile init) 1101 1094 else rc = O32_GetModuleFileName(hinstModule, lpszPath, cchPath); 1102 1095 1103 1096 if(rc) { 1104 dprintf(("KERNEL32: GetModuleFileName %s %d\n", lpszPath, hinstModule)); 1105 } 1097 dprintf(("KERNEL32: GetModuleFileName %s %d\n", lpszPath, hinstModule)); 1098 } 1099 else dprintf(("KERNEL32: WARNING: GetModuleFileName %x not found!", hinstModule)); 1106 1100 return(rc); 1107 1101 } … … 1132 1126 if(lpszModule == NULL) { 1133 1127 if(WinExe) 1134 hMod = WinExe->getInstanceHandle();1128 hMod = WinExe->getInstanceHandle(); 1135 1129 else hMod = -1; 1136 1130 } 1137 else { 1131 else 1132 { 1138 1133 strcpy(szModule, OSLibStripPath((char *)lpszModule)); 1139 1134 strupr(szModule); … … 1158 1153 windll = Win32DllBase::findModule(szModule); 1159 1154 if(windll) { 1160 hMod = windll->getInstanceHandle(); 1161 } 1162 else hMod = OSLibiGetModuleHandleA((char *)lpszModule); 1155 hMod = windll->getInstanceHandle(); 1156 } 1163 1157 } 1164 1158 } -
trunk/src/msacm32/initterm.cpp
r2650 r3993 1 /* $Id: initterm.cpp,v 1. 3 2000-02-05 02:02:34sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.4 2000-08-11 10:56:21 sandervl Exp $ */ 2 2 3 3 /* … … 44 44 extern DWORD _Resource_PEResTab; 45 45 } 46 static HMODULE dllHandle = 0; 46 47 47 48 BOOL WINAPI MSACM32_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); … … 91 92 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 92 93 93 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 94 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 95 if(dllHandle == 0) 94 96 return 0UL; 95 97 96 98 break; 97 99 case 1 : 98 UnregisterLxDll(hModule); 100 if(dllHandle) { 101 UnregisterLxDll(dllHandle); 102 } 99 103 break; 100 104 -
trunk/src/oleaut32/initterm.cpp
r2650 r3993 1 /* $Id: initterm.cpp,v 1. 6 2000-02-05 02:07:03sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.7 2000-08-11 10:56:22 sandervl Exp $ */ 2 2 3 3 /* … … 44 44 extern DWORD _Resource_PEResTab; 45 45 } 46 static HMODULE dllHandle = 0; 46 47 47 48 //Global DLL Data … … 108 109 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 109 110 110 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 111 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 112 if(dllHandle == 0) 111 113 return 0UL; 112 114 … … 123 125 } 124 126 case 1 : 125 UnregisterLxDll(hModule); 127 if(dllHandle) { 128 UnregisterLxDll(dllHandle); 129 } 126 130 break; 131 127 132 default : 128 133 return 0UL; -
trunk/src/opengl/glide/cvg/initterm.cpp
r2888 r3993 1 /* $Id: initterm.cpp,v 1. 1 2000-02-25 00:37:33sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.2 2000-08-11 10:56:22 sandervl Exp $ */ 2 2 3 3 /* … … 42 42 extern DWORD _Resource_PEResTab; 43 43 } 44 static HMODULE dllHandle = 0; 44 45 45 46 BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved); … … 89 90 CheckVersionFromHMOD(PE2LX_VERSION, hModule);/* PLF Wed 98-03-18 05:28:48*/ 90 91 91 /*******************************************************************/ 92 /* A DosExitList routine must be used to clean up if runtime calls */ 93 /* are required and the runtime is dynamically linked. */ 94 /*******************************************************************/ 95 96 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 97 return 0UL; 92 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 93 if(dllHandle == 0) 94 return 0UL; 98 95 99 96 break; 100 101 97 case 1 : 102 UnregisterLxDll(hModule); 98 if(dllHandle) { 99 UnregisterLxDll(dllHandle); 100 } 103 101 break; 104 102 -
trunk/src/opengl/glide/sst1/initterm.cpp
r2885 r3993 1 /* $Id: initterm.cpp,v 1. 1 2000-02-25 00:31:06sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.2 2000-08-11 10:56:22 sandervl Exp $ */ 2 2 3 3 /* … … 42 42 extern DWORD _Resource_PEResTab; 43 43 } 44 static HMODULE dllHandle = 0; 44 45 45 46 BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved); … … 89 90 CheckVersionFromHMOD(PE2LX_VERSION, hModule);/* PLF Wed 98-03-18 05:28:48*/ 90 91 91 /*******************************************************************/ 92 /* A DosExitList routine must be used to clean up if runtime calls */ 93 /* are required and the runtime is dynamically linked. */ 94 /*******************************************************************/ 95 96 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 97 return 0UL; 92 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 93 if(dllHandle == 0) 94 return 0UL; 98 95 99 96 break; 100 101 97 case 1 : 102 UnregisterLxDll(hModule); 98 if(dllHandle) { 99 UnregisterLxDll(dllHandle); 100 } 103 101 break; 104 102 -
trunk/src/opengl/glu/initterm.cpp
r2996 r3993 1 /* $Id: initterm.cpp,v 1. 7 2000-03-04 19:10:12 jeroenExp $ */1 /* $Id: initterm.cpp,v 1.8 2000-08-11 10:56:22 sandervl Exp $ */ 2 2 3 3 /* … … 43 43 extern DWORD _Resource_PEResTab; 44 44 } 45 static HMODULE dllHandle = 0; 45 46 46 47 //****************************************************************************** … … 86 87 _ctordtorInit(); 87 88 88 /*******************************************************************/89 /* A DosExitList routine must be used to clean up if runtime calls */90 /* are required and the runtime is dynamically linked. */91 /*******************************************************************/92 93 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE)94 return 0UL;95 96 89 CheckVersionFromHMOD(PE2LX_VERSION, hModule);/* PLF Wed 98-03-18 05:28:48*/ 97 90 91 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 92 if(dllHandle == 0) 93 return 0UL; 94 98 95 break; 99 100 96 case 1 : 101 UnregisterLxDll(hModule); 97 if(dllHandle) { 98 UnregisterLxDll(dllHandle); 99 } 102 100 break; 103 101 -
trunk/src/opengl/glut/initterm.cpp
r2996 r3993 1 /* $Id: initterm.cpp,v 1. 8 2000-03-04 19:10:16 jeroenExp $ */1 /* $Id: initterm.cpp,v 1.9 2000-08-11 10:56:23 sandervl Exp $ */ 2 2 3 3 /* … … 44 44 extern DWORD _Resource_PEResTab; 45 45 } 46 static HMODULE dllHandle = 0; 46 47 47 48 void CDECL Glut32Terminate(void); … … 88 89 _ctordtorInit(); 89 90 90 /*******************************************************************/91 /* A DosExitList routine must be used to clean up if runtime calls */92 /* are required and the runtime is dynamically linked. */93 /*******************************************************************/94 95 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE)96 return 0UL;97 98 91 CheckVersionFromHMOD(PE2LX_VERSION, hModule);/* PLF Wed 98-03-18 05:28:48*/ 99 92 93 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 94 if(dllHandle == 0) 95 return 0UL; 96 100 97 break; 101 102 98 case 1 : 103 UnregisterLxDll(hModule); 99 if(dllHandle) { 100 UnregisterLxDll(dllHandle); 101 } 104 102 break; 105 103 -
trunk/src/opengl/mesa/3dfx/initterm.cpp
r2938 r3993 1 /* $Id: initterm.cpp,v 1. 1 2000-02-29 00:46:18sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.2 2000-08-11 10:56:23 sandervl Exp $ */ 2 2 3 3 /* … … 44 44 extern DWORD _Resource_PEResTab; 45 45 } 46 static HMODULE dllHandle = 0; 46 47 47 48 int cleangraphics(void); … … 92 93 CheckVersionFromHMOD(PE2LX_VERSION, hModule);/* PLF Wed 98-03-18 05:28:48*/ 93 94 94 /*******************************************************************/ 95 /* A DosExitList routine must be used to clean up if runtime calls */ 96 /* are required and the runtime is dynamically linked. */ 97 /*******************************************************************/ 98 99 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 100 return 0UL; 95 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 96 if(dllHandle == 0) 97 return 0UL; 101 98 102 99 break; 103 100 104 101 case 1 : 105 UnregisterLxDll(hModule); 102 if(dllHandle) { 103 UnregisterLxDll(dllHandle); 104 } 106 105 break; 107 106 -
trunk/src/opengl/mesa/initterm.cpp
r3598 r3993 1 /* $Id: initterm.cpp,v 1. 4 2000-05-23 20:40:38 jeroenExp $ */1 /* $Id: initterm.cpp,v 1.5 2000-08-11 10:56:23 sandervl Exp $ */ 2 2 3 3 /* … … 44 44 extern DWORD _Resource_PEResTab; 45 45 } 46 static HMODULE dllHandle = 0; 46 47 47 48 #ifdef DIVE … … 97 98 CheckVersionFromHMOD(PE2LX_VERSION, hModule);/* PLF Wed 98-03-18 05:28:48*/ 98 99 99 /*******************************************************************/ 100 /* A DosExitList routine must be used to clean up if runtime calls */ 101 /* are required and the runtime is dynamically linked. */ 102 /*******************************************************************/ 103 104 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 105 return 0UL; 100 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 101 if(dllHandle == 0) 102 return 0UL; 106 103 107 104 #ifdef DIVE … … 112 109 113 110 case 1 : 114 UnregisterLxDll(hModule); 111 if(dllHandle) { 112 UnregisterLxDll(dllHandle); 113 } 115 114 break; 116 115 -
trunk/src/riched32/initterm.cpp
r3515 r3993 1 /* $Id: initterm.cpp,v 1. 1 2000-05-10 13:17:27sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.2 2000-08-11 10:56:24 sandervl Exp $ */ 2 2 3 3 /* … … 47 47 BOOL WINAPI RICHED32_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); 48 48 } 49 static HMODULE dllHandle = 0; 50 49 51 //****************************************************************************** 50 52 //****************************************************************************** … … 93 95 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 94 96 95 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 97 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 98 if(dllHandle == 0) 96 99 return 0UL; 97 100 98 101 break; 99 102 case 1 : 100 UnregisterLxDll(hModule); 103 if(dllHandle) { 104 UnregisterLxDll(dllHandle); 105 } 101 106 break; 107 102 108 default : 103 109 return 0UL; -
trunk/src/rpcrt4/initterm.cpp
r3313 r3993 1 /* $Id: initterm.cpp,v 1. 2 2000-04-03 07:53:26sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.3 2000-08-11 10:56:24 sandervl Exp $ */ 2 2 3 3 /* … … 45 45 extern DWORD _Resource_PEResTab; 46 46 } 47 static HMODULE dllHandle = 0; 47 48 48 49 //****************************************************************************** … … 91 92 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 92 93 93 /*******************************************************************/ 94 /* A DosExitList routine must be used to clean up if runtime calls */ 95 /* are required and the runtime is dynamically linked. */ 96 /*******************************************************************/ 97 98 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 94 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 95 if(dllHandle == 0) 99 96 return 0UL; 100 97 … … 104 101 105 102 break; 103 106 104 case 1 : 107 UnregisterLxDll(hModule); 105 if(dllHandle) { 106 UnregisterLxDll(dllHandle); 107 } 108 108 break; 109 109 default : -
trunk/src/shell32/initterm.cpp
r2649 r3993 1 /* $Id: initterm.cpp,v 1.1 0 2000-02-05 02:10:15 sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.11 2000-08-11 10:56:25 sandervl Exp $ */ 2 2 3 3 /* … … 46 46 extern DWORD _Resource_PEResTab; 47 47 } 48 static HMODULE dllHandle = 0; 48 49 49 50 BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad); … … 93 94 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 94 95 95 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 96 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab, 97 SHELL32_MAJORIMAGE_VERSION, SHELL32_MINORIMAGE_VERSION, 98 IMAGE_SUBSYSTEM_WINDOWS_GUI); 99 if(dllHandle == 0) 96 100 return 0UL; 97 101 98 102 break; 99 103 case 1 : 100 UnregisterLxDll(hModule); 104 if(dllHandle) { 105 UnregisterLxDll(dllHandle); 106 } 101 107 break; 102 108 default : -
trunk/src/twain_32/initterm.cpp
r2649 r3993 1 /* $Id: initterm.cpp,v 1. 8 2000-02-05 02:11:41sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.9 2000-08-11 10:56:25 sandervl Exp $ */ 2 2 3 3 /* … … 54 54 55 55 } 56 static HMODULE dllHandle = 0; 57 56 58 //****************************************************************************** 57 59 //****************************************************************************** … … 143 145 } 144 146 } 145 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 147 148 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 149 if(dllHandle == 0) 146 150 return 0UL; 147 151 … … 151 155 FreeLibrary(hTWAIN); 152 156 hTWAIN = 0; 153 UnregisterLxDll(hModule); 157 if(dllHandle) { 158 UnregisterLxDll(dllHandle); 159 } 154 160 break; 155 161 default : -
trunk/src/user32/initterm.cpp
r3101 r3993 1 /* $Id: initterm.cpp,v 1.2 2 2000-03-13 13:10:45sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.23 2000-08-11 10:56:26 sandervl Exp $ */ 2 2 3 3 /* … … 63 63 extern DWORD _Resource_PEResTab; 64 64 } 65 66 65 DWORD hInstanceUser32 = 0; 67 66 … … 93 92 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 94 93 95 hInstanceUser32 = RegisterLxDll(hModule, 0, (PVOID)&_Resource_PEResTab); 94 hInstanceUser32 = RegisterLxDll(hModule, 0, (PVOID)&_Resource_PEResTab, 95 USER32_MAJORIMAGE_VERSION, USER32_MINORIMAGE_VERSION, 96 IMAGE_SUBSYSTEM_WINDOWS_GUI); 96 97 if(hInstanceUser32 == 0) 97 98 return 0UL; … … 123 124 break; 124 125 case 1 : 125 UnregisterLxDll(hModule); 126 if(hInstanceUser32) { 127 UnregisterLxDll(hInstanceUser32); 128 } 126 129 break; 127 130 default : -
trunk/src/version/version.cpp
r2347 r3993 1 /* $Id: version.cpp,v 1. 9 2000-01-06 20:10:07sandervl Exp $ */1 /* $Id: version.cpp,v 1.10 2000-08-11 10:56:26 sandervl Exp $ */ 2 2 3 3 /* … … 22 22 #include <heapstring.h> 23 23 #include <version.h> 24 #include <versionos2.h> 24 25 25 26 ODINDEBUGCHANNEL(VERSION) -
trunk/src/wing32/initterm.cpp
r2650 r3993 1 /* $Id: initterm.cpp,v 1. 2 2000-02-05 02:13:34sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.3 2000-08-11 10:56:27 sandervl Exp $ */ 2 2 3 3 /* … … 45 45 extern DWORD _Resource_PEResTab; 46 46 } 47 static HMODULE dllHandle = 0; 48 47 49 //****************************************************************************** 48 50 //****************************************************************************** … … 95 97 return 0UL; 96 98 97 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 98 return 0UL; 99 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 100 if(dllHandle == 0) 101 return 0UL; 99 102 100 break;103 break; 101 104 } 102 105 case 1 : 103 UnregisterLxDll(hModule); 104 break; 106 if(dllHandle) { 107 UnregisterLxDll(dllHandle); 108 } 109 break; 105 110 default : 106 111 return 0UL; -
trunk/src/winmm/initterm.cpp
r2812 r3993 1 /* $Id: initterm.cpp,v 1. 9 2000-02-17 14:09:30sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.10 2000-08-11 10:56:27 sandervl Exp $ */ 2 2 3 3 /* … … 50 50 extern DWORD _Resource_PEResTab; 51 51 } 52 static HMODULE dllHandle = 0; 53 52 54 //****************************************************************************** 53 55 //****************************************************************************** … … 99 101 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 100 102 101 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 103 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 104 if(dllHandle == 0) 102 105 return 0UL; 103 106 … … 105 108 case 1 : 106 109 auxOS2Close(); /* SvL: Close aux device if necessary */ 107 UnregisterLxDll(hModule); 110 if(dllHandle) { 111 UnregisterLxDll(dllHandle); 112 } 108 113 break; 109 114 default : -
trunk/src/wsock32/initterm.cpp
r3229 r3993 1 /* $Id: initterm.cpp,v 1.1 1 2000-03-24 19:28:05sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.12 2000-08-11 10:56:27 sandervl Exp $ */ 2 2 3 3 /* … … 46 46 extern DWORD _Resource_PEResTab; 47 47 } 48 static HMODULE dllHandle = 0; 49 48 50 //****************************************************************************** 49 51 //****************************************************************************** … … 93 95 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 94 96 95 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 97 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 98 if(dllHandle == 0) 96 99 return 0UL; 97 100 98 101 break; 99 102 case 1 : 100 UnregisterLxDll(hModule); 103 if(dllHandle) { 104 UnregisterLxDll(dllHandle); 105 } 101 106 break; 102 107 default :
Note:
See TracChangeset
for help on using the changeset viewer.