Changeset 6015 for trunk/src/kernel32
- Timestamp:
- Jun 15, 2001, 11:42:49 AM (24 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/windllbase.cpp
r5782 r6015 1 /* $Id: windllbase.cpp,v 1.2 5 2001-05-22 14:25:34 sandervlExp $ */1 /* $Id: windllbase.cpp,v 1.26 2001-06-15 09:42:47 bird Exp $ */ 2 2 3 3 /* … … 32 32 #include <pefile.h> 33 33 #include <windllbase.h> 34 #include <winimagepe2lx.h> 35 #include <windllpe2lx.h> 36 #include <winimagelx.h> 37 #include <windlllx.h> 34 38 #include <wprocess.h> 35 39 #include "exceptions.h" … … 824 828 //****************************************************************************** 825 829 //****************************************************************************** 830 Win32DllBase *Win32DllBase::findModuleByOS2Handle(HINSTANCE hinstance) 831 { 832 dlllistmutex.enter(); 833 834 for (Win32DllBase *pMod = Win32DllBase::getFirst(); pMod; pMod = pMod->getNext()) 835 { 836 if (pMod->isLxDll()) 837 { 838 if (((Win32LxDll *)pMod)->getHMOD() == hinstance) 839 { 840 dlllistmutex.leave(); 841 return(pMod); 842 } 843 } 844 else if (pMod->isPe2LxDll()) 845 { 846 if (((Win32Pe2LxDll *)pMod)->getHMOD() == hinstance) 847 { 848 dlllistmutex.leave(); 849 return(pMod); 850 } 851 } 852 } 853 854 dlllistmutex.leave(); 855 return(NULL); 856 } 857 //****************************************************************************** 858 //****************************************************************************** 826 859 BOOL Win32DllBase::isDll() 827 860 { -
trunk/src/kernel32/windllbase.h
r4523 r6015 1 /* $Id: windllbase.h,v 1. 7 2000-10-23 13:42:43 sandervlExp $ */1 /* $Id: windllbase.h,v 1.8 2001-06-15 09:42:48 bird Exp $ */ 2 2 3 3 /* … … 30 30 #define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008 31 31 32 #define DLL_EXTENSION 32 #define DLL_EXTENSION ".DLL" 33 33 34 34 //odin.ini section names to lookup renamed dlls 35 35 //i.e. OLE32 -> OLE32OS2 36 #define DLLRENAMEWIN_SECTION 36 #define DLLRENAMEWIN_SECTION "DLLRENAMEWIN" 37 37 //i.e. OLE32OS2 -> OLE32 38 38 #define DLLRENAMEOS2_SECTION "DLLRENAMEOS2" … … 45 45 46 46 #ifdef DEBUG 47 virtual 47 virtual ULONG AddRef(char *parentname = NULL); 48 48 #else 49 49 virtual ULONG AddRef(); 50 50 #endif 51 virtual 51 virtual ULONG Release(); 52 52 53 53 char *getName() { return szModule; }; 54 54 55 55 //do not call the ATTACH_THREAD, DETACH_THREAD functions 56 57 56 void disableThreadLibraryCalls() { fSkipThreadEntryCalls = TRUE; }; 57 void disableLibraryCalls() { fSkipEntryCalls = fSkipThreadEntryCalls = TRUE; }; 58 58 59 60 static 59 Win32DllBase *getNext() { return next; }; 60 static Win32DllBase *getFirst(); 61 61 62 62 //Send DLL_THREAD_ATTACH message to all dlls for a new thread … … 72 72 static void tlsDetachThreadFromAllDlls(); 73 73 74 75 76 77 74 BOOL attachProcess(); 75 BOOL detachProcess(); 76 BOOL attachThread(); 77 BOOL detachThread(); 78 78 79 79 //This counter is incremented when the dll has been loaded with LoadLibrary(Ex) 80 80 //(== not loaded on behalf of another dll or the main exe) 81 void incDynamicLib(); 82 void decDynamicLib(); 83 BOOL isDynamicLib() { return nrDynamicLibRef != 0; }; 84 85 void setUnloadOrder(Win32ImageBase *parent); 81 void incDynamicLib(); 82 void decDynamicLib(); 83 BOOL isDynamicLib() { return nrDynamicLibRef != 0; }; 86 84 87 void updateDependencies();85 void setUnloadOrder(Win32ImageBase *parent); 88 86 89 BOOL RemoveCircularDependency(Win32DllBase *parent);87 void updateDependencies(); 90 88 91 //Only called for kernel32 92 void DisableUnload() { fDisableUnload = TRUE; }; 89 BOOL RemoveCircularDependency(Win32DllBase *parent); 90 91 //Only called for kernel32 92 void DisableUnload() { fDisableUnload = TRUE; }; 93 93 94 94 static void deleteDynamicLibs(); 95 95 static void deleteAll(); 96 96 97 static 97 static BOOL isSystemDll(char *szFileName); 98 98 99 virtual BOOL isLxDll() = 0; 99 virtual BOOL isPe2LxDll() const = 0; 100 virtual BOOL isLxDll() const = 0; 100 101 virtual BOOL isDll(); 101 102 … … 107 108 static Win32DllBase *findModule(WIN32DLLENTRY DllEntryPoint); 108 109 static Win32DllBase *findModuleByAddr(ULONG address); 110 static Win32DllBase *findModuleByOS2Handle(HINSTANCE hinstance); 109 111 110 112 #ifdef DEBUG_ENABLELOG_LEVEL2 111 113 void printListOfDlls(); 112 114 #endif 113 115 114 116 protected: 115 117 #ifdef DEBUG 116 118 void printDependencies(char *parent); 117 119 #endif 118 120 119 121 BOOL fSkipThreadEntryCalls, fUnloaded, fAttachedToProcess, fSkipEntryCalls; 120 122 121 123 WIN32DLLENTRY dllEntryPoint; 122 124 123 125 LONG referenced; 124 126 125 127 //This counter is incremented when the dll has been loaded with LoadLibrary(Ex) 126 128 //(== not loaded on behalf of another dll or the main exe) 127 129 BOOL nrDynamicLibRef; 128 130 129 131 BOOL fInserted; //inserted in dll list 130 132 131 132 BOOLfDisableUnload;133 //This flag is set when a dll has been loaded with DosLoadModule 134 BOOL fDisableUnload; 133 135 134 136 static Win32DllBase *head; 135 137 Win32DllBase *next; 136 138 private: 137 139 static Queue loadLibDlls; -
trunk/src/kernel32/windlllx.cpp
r5782 r6015 1 /* $Id: windlllx.cpp,v 1. 19 2001-05-22 14:25:36 sandervlExp $ */1 /* $Id: windlllx.cpp,v 1.20 2001-06-15 09:42:48 bird Exp $ */ 2 2 3 3 /* … … 6 6 * Copyright 1999-2000 Sander van Leeuwen (sandervl@xs4all.nl) 7 7 * 8 * TODO: Unloading of dlls probably needs to be fixed due to OS/2 bug 8 * TODO: Unloading of dlls probably needs to be fixed due to OS/2 bug 9 9 * (wrong unload order of dlls) 10 10 * … … 18 18 #define INCL_DOSMISC /* DOS Miscellanous values */ 19 19 #define INCL_WIN 20 #include <os2wrap.h> 20 #include <os2wrap.h> //Odin32 OS/2 api wrappers 21 21 #include <os2newapi.h> 22 22 #include <stdio.h> … … 37 37 #include <exe386.h> 38 38 39 #define DBG_LOCALLOG 39 #define DBG_LOCALLOG DBG_windlllx 40 40 #include "dbglocal.h" 41 41 … … 44 44 //System dlls set EntryPoint to 0 45 45 //Parameters: 46 // HINSTANCE hInstance 46 // HINSTANCE hInstance - OS/2 module handle 47 47 // WIN32DLLENTRY EntryPoint - Win32 dll entrypoint address 48 48 // PVOID pResData - pointer to win32 resource data … … 54 54 //Returns: Odin32 module handle 55 55 //****************************************************************************** 56 DWORD WIN32API RegisterLxDll(HINSTANCE hInstance, WIN32DLLENTRY EntryPoint, 57 PVOID pResData, 58 DWORD MajorImageVersion, 56 DWORD WIN32API RegisterLxDll(HINSTANCE hInstance, WIN32DLLENTRY EntryPoint, 57 PVOID pResData, 58 DWORD MajorImageVersion, 59 59 DWORD MinorImageVersion, 60 60 DWORD Subsystem) 61 { 61 { 62 62 APIRET rc; 63 63 Win32LxDll *windll; … … 66 66 67 67 if(OSLibGetDllName(hInstance, szFileName, sizeof(szFileName)) == FALSE) { 68 69 68 dprintf(("ERROR: RegisterLxDll: OSLibGetDllName %x failed!!", hInstance)); 69 return 0; 70 70 } 71 71 dprintf(("RegisterLxDll %x %s", hInstance, szFileName)); 72 //Make sure DosLoadModule is called at least once for a dll (to make sure 72 //Make sure DosLoadModule is called at least once for a dll (to make sure 73 73 //OS/2 doesn't unload the dll when it's still needed) 74 74 rc = DosLoadModule(szErrName, sizeof(szErrName), szFileName, &hInstance); 75 if(rc != 0) { 76 77 75 if(rc != 0) { 76 dprintf(("ERROR: RegisterLxDll: DosLoadModule %s failed (rc=%d)!!", szFileName, rc)); 77 return 0; 78 78 } 79 79 … … 81 81 MinorImageVersion, Subsystem); 82 82 if(windll == NULL) { 83 84 83 dprintf(("RegisterLxDll: windll == NULL!!!")); 84 return 0; 85 85 } 86 86 if(!fPeLoader) { 87 88 89 90 91 92 87 windll->AddRef(); 88 89 if(windll->attachProcess() == 0) 90 return 0; 91 92 return windll->getInstanceHandle(); 93 93 } 94 94 IMAGE_DOS_HEADER doshdr; … … 105 105 rc = DosQueryHeaderInfo(hInstance, 0, &doshdr, sizeof(IMAGE_DOS_HEADER), QHINF_READFILE); 106 106 if(rc) { 107 107 goto hdrerror; 108 108 } 109 109 rc = DosQueryHeaderInfo(hInstance, doshdr.e_lfanew, &lxhdr, sizeof(e32_exe), QHINF_READFILE); 110 110 if(rc) { 111 111 goto hdrerror; 112 112 } 113 113 offset = doshdr.e_lfanew + lxhdr.e32_impmod; 114 114 for(i=0;i<lxhdr.e32_impmodcnt;i++) { 115 116 117 118 119 120 121 122 123 124 125 126 127 128 115 rc = DosQueryHeaderInfo(hInstance, offset, &modsize, 1, QHINF_READFILE); 116 if(rc) { 117 goto hdrerror; 118 } 119 rc = DosQueryHeaderInfo(hInstance, offset+1, &modulename, min(modsize, sizeof(modulename)), QHINF_READFILE); 120 if(rc) { 121 goto hdrerror; 122 } 123 modulename[modsize] = 0; 124 windlldep = Win32DllBase::findModule(modulename, TRUE); 125 if(windlldep && strcmp(windlldep->getModuleName(), windll->getModuleName())) { 126 dprintf(("RegisterLxDll: Add dependency %s -> %s", windll->getModuleName(), modulename)); 127 windll->addDependency(windlldep); 128 } 129 129 else dprintf(("HARMLESS WARNING: Can't find dll %s referenced by %s", modulename, windll->getModuleName())); 130 130 offset += modsize + 1; 131 131 } 132 132 return windll->getInstanceHandle(); … … 146 146 //Don't do it either after ExitProcess has been called 147 147 if(!fPeLoader || WinExe == NULL) 148 148 return TRUE; 149 149 150 150 windll = Win32DllBase::findModule(hInstance); 151 151 if(!windll) { 152 153 152 dprintf(("UnregisterLxDll: Can't find dll with handle %x (already deleted)", hInstance)); 153 return TRUE; //already deleted by Win32LxDll::Release 154 154 } 155 155 dprintf(("UnregisterLxDll %s", windll->getModuleName())); … … 162 162 Win32LxDll::Win32LxDll(HINSTANCE hInstance, WIN32DLLENTRY EntryPoint, PVOID pResData, 163 163 DWORD MajorImageVersion, DWORD MinorImageVersion, 164 DWORD Subsystem) 164 DWORD Subsystem) 165 165 : Win32ImageBase(hInstance), 166 Win32LxImage(hInstance, pResData), 166 Win32LxImage(hInstance, pResData), 167 167 Win32DllBase(hInstance, EntryPoint) 168 168 { … … 170 170 this->MinorImageVersion = MinorImageVersion; 171 171 this->Subsystem = Subsystem; 172 172 173 173 if(EntryPoint == NULL) { 174 175 174 fSkipThreadEntryCalls = TRUE; 175 fAttachedToProcess = TRUE; 176 176 } 177 177 hinstanceOS2 = hInstance; … … 206 206 207 207 if(!fPeLoader) 208 209 210 if(referenced == 1) 208 return ret; 209 210 if(referenced == 1) 211 211 { 212 213 214 215 216 217 218 219 212 item = loadedDlls.Head(); 213 while(item) { 214 dll = (Win32DllBase *)loadedDlls.getItem(item); 215 if(dll == NULL) { 216 dprintf(("ERROR: Win32DllBase::AddRef: dll item == NULL!!")); 217 DebugInt3(); 218 return -1; 219 } 220 220 #ifdef DEBUG 221 221 dll->AddRef(getModuleName()); 222 222 #else 223 223 dll->AddRef(); 224 224 #endif 225 226 227 228 229 230 225 item = loadedDlls.getNext(item); 226 } 227 if(attachProcess() == 0) { 228 dprintf(("WARNING: Dll %s refused to be loaded; aborting", getName())); 229 return -1; 230 } 231 231 } 232 return ret; 232 return ret; 233 233 } 234 234 //****************************************************************************** 235 235 //****************************************************************************** 236 236 ULONG Win32LxDll::Release() 237 { 237 { 238 238 HINSTANCE hinst; 239 239 WIN32DLLENTRY EntryPointTmp = dllEntryPoint; … … 250 250 ret = Win32DllBase::Release(); 251 251 if(ret == 0 && !fNoUnload) {//only set for kernel32.dll (fDisableUnload) 252 252 //DosFreeModule sends a termination message to the dll. 253 253 //The LX dll informs us when it's removed (UnregisterDll call) 254 255 254 rc = DosFreeModule(hinst); 255 if(rc) { 256 256 dprintf(("Win32LxDll::Release: DosFreeModule %x returned %d", hinst, rc)); 257 257 if(rc == ERROR_INVALID_ACCESS && !fExitProcess) { … … 263 263 // don't fail! 264 264 dprintf(("WORKAROUND: Re-register the dll so future LoadLibrary calls don't fail!")); 265 RegisterLxDll(hinst, EntryPointTmp, pResDataTmp, 266 MajorImageVersionTmp, 265 RegisterLxDll(hinst, EntryPointTmp, pResDataTmp, 266 MajorImageVersionTmp, 267 267 MinorImageVersionTmp, 268 268 SubsystemTmp); … … 286 286 else DebugInt3(); 287 287 } 288 288 } 289 289 } 290 290 return(ret); … … 292 292 //****************************************************************************** 293 293 //****************************************************************************** 294 BOOL Win32LxDll::isLxDll() 294 BOOL Win32LxDll::isPe2LxDll() const 295 { 296 return FALSE; 297 } 298 //****************************************************************************** 299 //****************************************************************************** 300 BOOL Win32LxDll::isLxDll() const 295 301 { 296 302 return TRUE; … … 298 304 //****************************************************************************** 299 305 //****************************************************************************** 300 void Win32LxDll::setDllHandleOS2(HINSTANCE hInstanceOS2) 301 { 306 void Win32LxDll::setDllHandleOS2(HINSTANCE hInstanceOS2) 307 { 302 308 //Loaded with LoadLibrary(Ex); no need for a 2nd DosLoadModule 303 309 //Dlls that are indirectly loaded (i.e. GDI32->KERNEL32 dependancy) need 304 310 //this additional DosLoadModule (and setDllHandleOS2 isn't called for those) 305 311 if(this->hinstanceOS2) { 306 312 DosFreeModule(this->hinstanceOS2); 307 313 } 308 314 this->hinstanceOS2 = hInstanceOS2; … … 312 318 Win32LxDll *Win32LxDll::findModuleByOS2Handle(HINSTANCE hinstance) 313 319 { 314 dlllistmutex.enter(); 315 316 Win32DllBase *mod = Win32DllBase::getFirst(); 317 while(mod != NULL) { 318 if(mod->isLxDll()) { 319 Win32LxDll *lxdll = (Win32LxDll *)mod; 320 if(lxdll->hinstanceOS2 == hinstance) { 321 dlllistmutex.leave(); 322 return(lxdll); 323 } 320 dlllistmutex.enter(); 321 322 Win32DllBase *mod = Win32DllBase::getFirst(); 323 while (mod != NULL) 324 { 325 if (mod->isLxDll()) 326 { 327 Win32LxDll *lxdll = (Win32LxDll *)mod; 328 if (lxdll->hinstanceOS2 == hinstance) 329 { 330 dlllistmutex.leave(); 331 return(lxdll); 332 } 324 333 } 325 326 }327 dlllistmutex.leave();328 return(NULL);329 } 330 //****************************************************************************** 331 //****************************************************************************** 334 mod = mod->getNext(); 335 } 336 dlllistmutex.leave(); 337 return(NULL); 338 } 339 //****************************************************************************** 340 //****************************************************************************** -
trunk/src/kernel32/windlllx.h
r5075 r6015 1 /* $Id: windlllx.h,v 1. 3 2001-02-09 18:31:05 sandervlExp $ */1 /* $Id: windlllx.h,v 1.4 2001-06-15 09:42:48 bird Exp $ */ 2 2 3 3 /* … … 19 19 { 20 20 public: 21 21 Win32LxDll(HINSTANCE hInstance, WIN32DLLENTRY DllEntryPoint, PVOID pResData, 22 22 DWORD MajorImageVersion, DWORD MinorImageVersion, 23 23 DWORD Subsystem); … … 25 25 26 26 #ifdef DEBUG 27 virtual 27 virtual ULONG AddRef(char *parentname = NULL); 28 28 #else 29 29 virtual ULONG AddRef(); 30 30 #endif 31 virtual 31 virtual ULONG Release(); 32 32 33 33 void setDllHandleOS2(HINSTANCE hInstanceOS2); 34 34 35 virtual BOOL isLxDll(); 35 virtual BOOL isPe2LxDll() const; 36 virtual BOOL isLxDll() const; 36 37 37 38 static Win32LxDll *findModuleByOS2Handle(HINSTANCE hinstance); 38 39 39 40 protected: 40 41 DWORD MajorImageVersion; -
trunk/src/kernel32/windllpe2lx.cpp
r3993 r6015 1 /* $Id: windllpe2lx.cpp,v 1. 8 2000-08-11 10:56:19 sandervlExp $ */1 /* $Id: windllpe2lx.cpp,v 1.9 2001-06-15 09:42:48 bird Exp $ */ 2 2 3 3 /* … … 35 35 #include "console.h" 36 36 37 #define DBG_LOCALLOG 37 #define DBG_LOCALLOG DBG_windllpe2lx 38 38 #include "dbglocal.h" 39 39 … … 173 173 } 174 174 175 176 /** 177 * Simple question: Pe2Lx DLL? Yes! 178 * @returns TRUE. 179 * @status completely implemented. 180 * @author knut st. osmundsen 181 */ 182 BOOL Win32Pe2LxDll::isPe2LxDll() const 183 { 184 return TRUE; 185 } 186 187 175 188 /** 176 189 * Simple question: -Native LX dll? … … 180 193 * @author Sander van Leeuwen 181 194 */ 182 BOOL Win32Pe2LxDll::isLxDll() 195 BOOL Win32Pe2LxDll::isLxDll() const 183 196 { 184 197 return FALSE; 185 198 } 186 199 200 201 -
trunk/src/kernel32/windllpe2lx.h
r3074 r6015 1 /* $Id: windllpe2lx.h,v 1. 1 2000-03-10 16:12:02 sandervlExp $ */1 /* $Id: windllpe2lx.h,v 1.2 2001-06-15 09:42:48 bird Exp $ */ 2 2 3 3 /* … … 26 26 /** @cat Constructor/Destructor */ 27 27 Win32Pe2LxDll(HINSTANCE hinstance, BOOL fWin32k) throw(ULONG); 28 virtual ~Win32Pe2LxDll();29 BOOL init();28 virtual ~Win32Pe2LxDll(); 29 BOOL init(); 30 30 31 31 /** @cat Query */ 32 virtual BOOL isLxDll(); 32 BOOL isPe2LxDll() const; 33 BOOL isLxDll() const; 33 34 }; 34 35 -
trunk/src/kernel32/windllpeldr.cpp
r4523 r6015 1 /* $Id: windllpeldr.cpp,v 1. 8 2000-10-23 13:42:44 sandervlExp $ */1 /* $Id: windllpeldr.cpp,v 1.9 2001-06-15 09:42:48 bird Exp $ */ 2 2 3 3 /* … … 16 16 #define INCL_DOSMISC /* DOS Miscellanous values */ 17 17 #define INCL_WIN 18 #include <os2wrap.h> 18 #include <os2wrap.h> //Odin32 OS/2 api wrappers 19 19 #include <stdio.h> 20 20 #include <string.h> … … 31 31 #include "oslibdos.h" 32 32 33 #define DBG_LOCALLOG 33 #define DBG_LOCALLOG DBG_windllpeldr 34 34 #include "dbglocal.h" 35 35 … … 37 37 //****************************************************************************** 38 38 //****************************************************************************** 39 Win32PeLdrDll::Win32PeLdrDll(char *szDllName, Win32ImageBase *parentImage) 40 : Win32ImageBase(-1), 41 Win32DllBase(-1, 0, parentImage), 39 Win32PeLdrDll::Win32PeLdrDll(char *szDllName, Win32ImageBase *parentImage) 40 : Win32ImageBase(-1), 41 Win32DllBase(-1, 0, parentImage), 42 42 Win32PeLdrImage(szDllName, FALSE) 43 43 { … … 63 63 strupr(szFileName); 64 64 if(!strchr(szFileName, (int)'.')) { 65 65 strcat(szFileName, DLL_EXTENSION); 66 66 } 67 67 dllfile = OSLibDosOpen(szFileName, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 68 68 if(dllfile == NULL) {//search in libpath for dll 69 70 71 72 73 74 75 76 77 69 syspath = getenv("WIN32LIBPATH"); 70 if(syspath) { 71 strcpy(modname, syspath); 72 if(modname[strlen(modname)-1] != '\\') { 73 strcat(modname, "\\"); 74 } 75 strcat(modname, szFileName); 76 strcpy(szFileName, modname); 77 } 78 78 } 79 else 79 else OSLibDosClose(dllfile); 80 80 fRet = Win32PeLdrImage::init(0); 81 81 dllEntryPoint = (WIN32DLLENTRY)entryPoint; 82 82 83 83 if(!(fh.Characteristics & IMAGE_FILE_DLL)) { 84 85 86 84 //executable loaded as dll; don't call entrypoint 85 dprintf(("WARNING: Exe %s loaded as dll; entrypoint not called", szFileName)); 86 dllEntryPoint = NULL; 87 87 } 88 88 return fRet; … … 90 90 //****************************************************************************** 91 91 //****************************************************************************** 92 BOOL Win32PeLdrDll::is LxDll()92 BOOL Win32PeLdrDll::isPe2LxDll() const 93 93 { 94 94 return FALSE; … … 96 96 //****************************************************************************** 97 97 //****************************************************************************** 98 BOOL Win32PeLdrDll::isLxDll() const 99 { 100 return FALSE; 101 } 102 //****************************************************************************** 103 //****************************************************************************** -
trunk/src/kernel32/windllpeldr.h
r3074 r6015 1 /* $Id: windllpeldr.h,v 1. 1 2000-03-10 16:12:02 sandervlExp $ */1 /* $Id: windllpeldr.h,v 1.2 2001-06-15 09:42:49 bird Exp $ */ 2 2 3 3 /* … … 19 19 { 20 20 public: 21 21 Win32PeLdrDll(char *szDllName, Win32ImageBase *parentImage = NULL); 22 22 virtual ~Win32PeLdrDll(); 23 23 24 24 virtual BOOL init(ULONG reservedMem); 25 25 26 virtual BOOL isLxDll(); 26 BOOL isLxDll() const; 27 BOOL isPe2LxDll() const; 27 28 28 29 protected: -
trunk/src/kernel32/winimagelx.h
r3993 r6015 1 /* $Id: winimagelx.h,v 1. 2 2000-08-11 10:56:19 sandervlExp $ */1 /* $Id: winimagelx.h,v 1.3 2001-06-15 09:42:49 bird Exp $ */ 2 2 3 3 /* … … 21 21 virtual ~Win32LxImage(); 22 22 23 virtual 23 virtual ULONG getApi(char *name); 24 24 virtual ULONG getApi(int ordinal); 25 25 26 26 LPVOID buildHeader(DWORD MajorImageVersion, DWORD MinorImageVersion, 27 27 DWORD Subsystem); 28 28 /** Get the OS/2 module handle. 29 * @returns OS/2 module handle. */ 30 HINSTANCE getHMOD() const { return hinstance; } 29 31 protected: 30 32 LPVOID header; -
trunk/src/kernel32/winimagepe2lx.h
r4368 r6015 1 /* $Id: winimagepe2lx.h,v 1. 6 2000-10-02 13:35:23bird Exp $ */1 /* $Id: winimagepe2lx.h,v 1.7 2001-06-15 09:42:49 bird Exp $ */ 2 2 3 3 /* … … 40 40 /** @cat constructor and destructor */ 41 41 Win32Pe2LxImage(HINSTANCE hinstance, BOOL fWin32k); 42 virtual ~Win32Pe2LxImage();43 virtual BOOL init();42 virtual ~Win32Pe2LxImage(); 43 virtual BOOL init(); 44 44 45 45 /** @cat Exports */ 46 virtual ULONG getApi(char *name); 47 virtual ULONG getApi(int ordinal); 46 virtual ULONG getApi(char *name); 47 virtual ULONG getApi(int ordinal); 48 49 /** @cat Queries */ 50 /** Get the OS/2 module handle. 51 * @returns OS/2 module handle. */ 52 HINSTANCE getHMOD() const { return hmod; } 48 53 49 54 private: 50 55 /** @cat constructor helpers */ 51 ULONG getSections();52 ULONG setSectionRVAs();53 VOID cleanup();56 ULONG getSections(); 57 ULONG setSectionRVAs(); 58 VOID cleanup(); 54 59 55 60 protected: 56 61 /** @cat RVA -> pointer */ 57 62 /* these should be moved to winimagebase some day... */ 58 PVOID getPointerFromRVA(ULONG ulRVA);59 PVOID getPointerFromPointer(PVOID pv);60 LONG getSectionIndexFromRVA(ULONG ulRVA);61 BOOL validateRealPointer(PVOID pv);63 PVOID getPointerFromRVA(ULONG ulRVA); 64 PVOID getPointerFromPointer(PVOID pv); 65 LONG getSectionIndexFromRVA(ULONG ulRVA); 66 BOOL validateRealPointer(PVOID pv); 62 67 63 68 PSECTION paSections; /* Used by getPointerFromRVA and created by getSections and … … 69 74 BOOL fWin32k; /* flag which indicates wether this is a Win32k loaded 70 75 * module (TRUE) or and Pe2Lx module (FALSE). */ 71 HMODULE hmod;/* OS/2 handle of the module. */76 HMODULE hmod; /* OS/2 handle of the module. */ 72 77 }; 73 78 -
trunk/src/kernel32/wprocess.cpp
r5974 r6015 1 /* $Id: wprocess.cpp,v 1.12 4 2001-06-12 17:03:34 sandervlExp $ */1 /* $Id: wprocess.cpp,v 1.125 2001-06-15 09:42:49 bird Exp $ */ 2 2 3 3 /* … … 789 789 790 790 /** @sketch 791 * IF dwFlags == 0 && (!fPeLoader || !fPE) THEN791 * IF (!fPeLoader || fPE == failure) THEN 792 792 * Try load the executable using LoadLibrary 793 793 * IF successfully loaded THEN … … 802 802 */ 803 803 //only call OS/2 if LX binary or win32k process 804 if (!fPeLoader || fPE != ERROR_SUCCESS)804 if (!fPeLoader || fPE != ERROR_SUCCESS) 805 805 { 806 806 hDll = OSLibDosLoadModule(szModname); … … 808 808 { 809 809 /* OS/2 dll, system dll, converted dll or win32k took care of it. */ 810 pModule = (Win32DllBase *)Win32LxDll::findModuleByOS2Handle(hDll);811 if (pModule)810 pModule = Win32DllBase::findModuleByOS2Handle(hDll); 811 if (pModule) 812 812 { 813 if (pModule->isLxDll())813 if (pModule->isLxDll()) 814 814 { 815 816 if(fPeLoader)817 {818 if(pModule->AddRef() == -1) {//-1 -> load failed (attachProcess)819 dprintf(("Dll %s refused to be loaded; aborting", szModname));820 delete pModule;821 822 823 } 815 ((Win32LxDll *)pModule)->setDllHandleOS2(hDll); 816 if (fPeLoader && pModule->AddRef() == -1) 817 { //-1 -> load failed (attachProcess) 818 delete pModule; 819 SetLastError(ERROR_INVALID_EXE_SIGNATURE); 820 dprintf(("Dll %s refused to be loaded; aborting", szModname)); 821 return 0; 822 } 823 824 824 } 825 825 pModule->incDynamicLib(); 826 826 } 827 else 828 if(fExeStarted) { 827 else if (fExeStarted) { 829 828 OSLibDosFreeModule(hDll); 830 829 SetLastError(ERROR_INVALID_EXE_SIGNATURE); … … 1565 1564 #ifdef DEBUG 1566 1565 if(lpStartupInfo) { 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1566 dprintf(("lpStartupInfo->lpReserved %x", lpStartupInfo->lpReserved)); 1567 dprintf(("lpStartupInfo->lpDesktop %x", lpStartupInfo->lpDesktop)); 1568 dprintf(("lpStartupInfo->lpTitle %s", lpStartupInfo->lpTitle)); 1569 dprintf(("lpStartupInfo->dwX %x", lpStartupInfo->dwX)); 1570 dprintf(("lpStartupInfo->dwY %x", lpStartupInfo->dwY)); 1571 dprintf(("lpStartupInfo->dwXSize %x", lpStartupInfo->dwXSize)); 1572 dprintf(("lpStartupInfo->dwYSize %x", lpStartupInfo->dwYSize)); 1573 dprintf(("lpStartupInfo->dwXCountChars %x", lpStartupInfo->dwXCountChars)); 1574 dprintf(("lpStartupInfo->dwYCountChars %x", lpStartupInfo->dwYCountChars)); 1575 dprintf(("lpStartupInfo->dwFillAttribute %x", lpStartupInfo->dwFillAttribute)); 1576 dprintf(("lpStartupInfo->dwFlags %x", lpStartupInfo->dwFlags)); 1577 dprintf(("lpStartupInfo->wShowWindow %x", lpStartupInfo->wShowWindow)); 1578 dprintf(("lpStartupInfo->hStdInput %x", lpStartupInfo->hStdInput)); 1579 dprintf(("lpStartupInfo->hStdOutput %x", lpStartupInfo->hStdOutput)); 1580 dprintf(("lpStartupInfo->hStdError %x", lpStartupInfo->hStdError)); 1582 1581 } 1583 1582 #endif … … 1701 1700 1702 1701 dprintf(("KERNEL32: CreateProcess %s\n", cmdline)); 1703 1702 1704 1703 DWORD Characteristics, SubSystem, fNEExe; 1705 1704 if(Win32ImageBase::isPEImage(exename, &Characteristics, &SubSystem, &fNEExe) == 0) { … … 1709 1708 } 1710 1709 else lpszPE = "PE.EXE"; 1711 1710 1712 1711 //SvL: Allright. Before we call O32_CreateProcess, we must take care of 1713 1712 // lpCurrentDirectory ourselves. (Open32 ignores it!) 1714 1713 if(lpCurrentDirectory) { 1715 1714 char *newcmdline; 1716 1715 1717 1716 newcmdline = (char *)malloc(strlen(lpCurrentDirectory) + strlen(cmdline) + 32); 1718 1717 sprintf(newcmdline, "%s /OPT:[CURDIR=%s] %s", lpszPE, lpCurrentDirectory, cmdline); … … 1733 1732 lpProcessInfo); 1734 1733 } 1735 else 1734 else 1736 1735 if(fNEExe) {//16 bits windows app 1737 1736 char *newcmdline; 1738 1737 1739 1738 newcmdline = (char *)malloc(strlen(cmdline) + 16); 1740 1739 sprintf(newcmdline, "w16odin.exe %s", cmdline);
Note:
See TracChangeset
for help on using the changeset viewer.