- Timestamp:
- Aug 10, 1999, 12:10:09 AM (26 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
-
kernel32/HandleManager.cpp (modified) (4 diffs)
-
kernel32/heap.cpp (modified) (5 diffs)
-
kernel32/os2heap.cpp (modified) (4 diffs)
-
kernel32/thread.cpp (modified) (4 diffs)
-
kernel32/winimage.cpp (modified) (6 diffs)
-
kernel32/wprocess.cpp (modified) (21 diffs)
-
odincrt/makefile (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/HandleManager.cpp
r382 r461 1 /* $Id: HandleManager.cpp,v 1. 7 1999-07-24 12:38:58 sandervlExp $ */1 /* $Id: HandleManager.cpp,v 1.8 1999-08-09 22:10:07 phaller Exp $ */ 2 2 3 3 /* … … 46 46 #include <stdlib.h> 47 47 #include <string.h> 48 #include <odincrt.h> 49 48 50 #include "unicode.h" 49 51 #include "misc.h" … … 308 310 309 311 /* create handle manager instance for Open32 handles */ 312 ODIN_FS_BEGIN 310 313 HMGlobals.pHMOpen32 = new HMDeviceOpen32Class("\\\\.\\"); 311 314 HMGlobals.pHMEvent = new HMDeviceEventClass("\\\\EVENT\\"); 312 315 HMGlobals.pHMMutex = new HMDeviceMutexClass("\\\\MUTEX\\"); 313 316 HMGlobals.pHMSemaphore = new HMDeviceSemaphoreClass("\\\\SEM\\"); 317 ODIN_FS_END 314 318 } 315 319 return (NO_ERROR); … … 333 337 /* @@@PH we could deallocate the device list here */ 334 338 339 ODIN_FS_BEGIN 335 340 delete HMGlobals.pHMOpen32; 336 341 delete HMGlobals.pHMEvent; 337 342 delete HMGlobals.pHMMutex; 338 343 delete HMGlobals.pHMSemaphore; 344 ODIN_FS_END 339 345 340 346 return (NO_ERROR); -
trunk/src/kernel32/heap.cpp
r408 r461 1 /* $Id: heap.cpp,v 1. 9 1999-08-04 00:46:14phaller Exp $ */1 /* $Id: heap.cpp,v 1.10 1999-08-09 22:10:08 phaller Exp $ */ 2 2 3 3 /* … … 18 18 #define _WIN32 19 19 #include "os2heap.h" 20 #include <odincrt.h> 20 21 #include "heap.h" 21 22 … … 68 69 return(NULL); 69 70 71 ODIN_FS_BEGIN 70 72 curheap = new OS2Heap(hHeap, flOptions, dwInitialSize, dwMaximumSize); 71 if(curheap == NULL) { 73 ODIN_FS_END 74 75 if(curheap == NULL) 76 { 72 77 O32_HeapDestroy(hHeap); 73 78 return(NULL); 74 79 } 75 if(curheap->getHeapHandle() == NULL) { 76 O32_HeapDestroy(hHeap); 77 delete curheap; 78 return(NULL); 80 81 if(curheap->getHeapHandle() == NULL) 82 { 83 O32_HeapDestroy(hHeap); 84 ODIN_delete(curheap); 85 return(NULL); 79 86 } 80 87 return(curheap->getHeapHandle()); … … 90 97 91 98 O32_HeapDestroy(curheap->getHeapHandle()); 92 delete curheap;99 ODIN_delete(curheap); 93 100 return(TRUE); 94 101 } … … 151 158 //TODO: I haven't thought real hard about this. I added it just to make "hdr.exe" happy. 152 159 hHeap = O32_HeapCreate(HEAP_GENERATE_EXCEPTIONS, 1, 0x4000); 160 161 ODIN_FS_BEGIN 153 162 OS2ProcessHeap = new OS2Heap(hHeap, HEAP_GENERATE_EXCEPTIONS, 0x4000, 0); 163 ODIN_FS_END 164 154 165 if(OS2ProcessHeap == NULL) { 155 166 O32_HeapDestroy(hHeap); -
trunk/src/kernel32/os2heap.cpp
r404 r461 1 /* $Id: os2heap.cpp,v 1. 5 1999-08-03 17:38:59phaller Exp $ */1 /* $Id: os2heap.cpp,v 1.6 1999-08-09 22:10:08 phaller Exp $ */ 2 2 3 3 /* … … 17 17 #include <stdlib.h> 18 18 #include <string.h> 19 #include <odincrt.h> 20 19 21 #include "win32type.h" 20 22 #include "os2heap.h" … … 50 52 dprintf(("KERNEL32: HeapCreate: initial size %d, max size %d (flags %X) returned %X\n", dwInitialSize, dwMaximumSize, flOptions, hPrimaryHeap)); 51 53 52 if(!(flOptions & HEAP_NO_SERIALIZE)) { 54 if(!(flOptions & HEAP_NO_SERIALIZE)) 55 { 56 ODIN_FS_BEGIN 53 57 hmutex = new VMutex(); 58 ODIN_FS_END 54 59 dassert(hmutex, ("ERROR: new VMutex\n")); 55 60 } … … 86 91 heapelem = hnext; 87 92 } 88 if(hmutex) { 93 if(hmutex) 94 { 89 95 hmutex->leave(); 90 delete hmutex;96 ODIN_delete(hmutex); 91 97 } 92 98 -
trunk/src/kernel32/thread.cpp
r281 r461 1 /* $Id: thread.cpp,v 1. 7 1999-07-07 08:11:10 sandervlExp $ */1 /* $Id: thread.cpp,v 1.8 1999-08-09 22:10:08 phaller Exp $ */ 2 2 3 3 /* … … 12 12 #include <os2win.h> 13 13 #include <stdarg.h> 14 #include <odincrt.h> 14 15 #include "thread.h" 15 16 #include "except.h" … … 29 30 LPDWORD lpIDThread) 30 31 { 31 Win32Thread *winthread = new Win32Thread(lpStartAddr, lpvThreadParm, fdwCreate); 32 Win32Thread *winthread; 33 34 ODIN_FS_BEGIN 35 winthread = new Win32Thread(lpStartAddr, lpvThreadParm, fdwCreate); 36 ODIN_FS_END 32 37 33 38 if(winthread == 0) … … 157 162 DWORD rc; 158 163 159 delete me;//only called once164 ODIN_delete(me) //only called once 160 165 161 166 dprintf(("Win32ThreadProc %d\n", GetCurrentThreadId())); -
trunk/src/kernel32/winimage.cpp
r281 r461 1 /* $Id: winimage.cpp,v 1. 5 1999-07-07 08:11:10 sandervlExp $ */1 /* $Id: winimage.cpp,v 1.6 1999-08-09 22:10:09 phaller Exp $ */ 2 2 3 3 /* … … 11 11 * 12 12 */ 13 13 14 #define INCL_DOSFILEMGR /* File Manager values */ 14 15 #define INCL_DOSMODULEMGR … … 18 19 #define INCL_WIN 19 20 #define INCL_BASE 20 #include <os2wrap.h> //Odin32 OS/2 api wrappers 21 #include <os2wrap.h> //Odin32 OS/2 api wrappers 22 21 23 #include <stdio.h> 22 24 #include <string.h> 23 25 #include <stdlib.h> 26 27 #include <odincrt.h> 28 24 29 #include <iostream.h> 25 30 #include <fstream.h> … … 138 143 DosFreeResource((PVOID)Win32Table); 139 144 140 while(winres) { 145 while(winres) 146 { 141 147 res = winres->next; 142 delete winres;148 ODIN_delete(winres); 143 149 winres = res; 144 150 } … … 301 307 continue; 302 308 } 303 if(IsImportSection(win32file, &psh[i])) 309 if(IsImportSection(win32file, &psh[i])) 304 310 { 305 311 int type = SECTION_IMPORT; … … 975 981 fout << "**********************************************************************" << endl; 976 982 WinDll = Win32Dll::findModule(pszCurModule); 977 if(WinDll == NULL) {//not found, so load it 983 if(WinDll == NULL) 984 { //not found, so load it 985 ODIN_FS_BEGIN 978 986 WinDll = new Win32Dll(pszCurModule); 987 ODIN_FS_END 979 988 980 989 if(WinDll == NULL) { -
trunk/src/kernel32/wprocess.cpp
r426 r461 1 /* $Id: wprocess.cpp,v 1.1 6 1999-08-05 19:50:34phaller Exp $ */1 /* $Id: wprocess.cpp,v 1.17 1999-08-09 22:10:09 phaller Exp $ */ 2 2 3 3 /* … … 14 14 #include <stdlib.h> 15 15 #include <string.h> 16 #include <odincrt.h> 17 16 18 #include "unicode.h" 17 19 #include "windll.h" … … 35 37 //Process database 36 38 PDB ProcessPDB = {0}; 37 USHORT ProcessTIBSel = 0;39 USHORT ProcessTIBSel = 0; 38 40 DWORD *TIBFlatPtr = 0; 39 41 … … 55 57 winteb = (TEB *)*TIBFlatPtr; 56 58 if(winteb == NULL) { 57 return NULL;59 return NULL; 58 60 } 59 61 thdb = (THDB *)(winteb+1); … … 74 76 TIBFlatPtr = (DWORD *)OS2AllocThreadLocalMemory(1); 75 77 if(TIBFlatPtr == 0) { 76 dprintf(("InitializeTIB: local thread memory alloc failed!!"));77 DebugInt3();78 return NULL;78 dprintf(("InitializeTIB: local thread memory alloc failed!!")); 79 DebugInt3(); 80 return NULL; 79 81 } 80 82 if(OS2AllocSel(PAGE_SIZE, &tibsel) == FALSE) 81 83 { 82 dprintf(("InitializeTIB: selector alloc failed!!"));83 DebugInt3();84 return NULL;84 dprintf(("InitializeTIB: selector alloc failed!!")); 85 DebugInt3(); 86 return NULL; 85 87 } 86 88 winteb = (TEB *)OS2SelToFlat(tibsel); 87 89 if(winteb == NULL) 88 90 { 89 dprintf(("InitializeTIB: DosSelToFlat failed!!"));90 DebugInt3();91 return NULL;91 dprintf(("InitializeTIB: DosSelToFlat failed!!")); 92 DebugInt3(); 93 return NULL; 92 94 } 93 95 memset(winteb, 0, PAGE_SIZE); … … 114 116 if(OS2GetPIB(PIB_TASKTYPE) == TASKTYPE_PM) 115 117 { 116 thdb->flags = 0; //todo gui117 } 118 else thdb->flags = 0; //todo textmode118 thdb->flags = 0; //todo gui 119 } 120 else thdb->flags = 0; //todo textmode 119 121 120 122 if(fMainThread) 121 123 { 122 //todo initialize PDB during process creation124 //todo initialize PDB during process creation 123 125 //todo: initialize TLS array if required 124 126 //TLS in executable always TLS index 0? 125 ProcessTIBSel = tibsel;127 ProcessTIBSel = tibsel; 126 128 } 127 129 dprintf(("InitializeTIB setup TEB with selector %x", tibsel)); … … 143 145 winteb = (TEB *)*TIBFlatPtr; 144 146 if(winteb) { 145 thdb = (THDB *)(winteb+1);146 orgtibsel = thdb->OrgTIBSel;147 148 //Restore our original FS selector149 SetFS(orgtibsel);150 151 //And free our own152 OS2FreeSel(thdb->teb_sel);147 thdb = (THDB *)(winteb+1); 148 orgtibsel = thdb->OrgTIBSel; 149 150 //Restore our original FS selector 151 SetFS(orgtibsel); 152 153 //And free our own 154 OS2FreeSel(thdb->teb_sel); 153 155 } 154 156 else dprintf(("Already destroyed TIB")); … … 168 170 winteb = (TEB *)*TIBFlatPtr; 169 171 if(winteb) { 170 thdb = (THDB *)(winteb+1);171 orgtibsel = thdb->OrgTIBSel;172 173 //Restore our original FS selector174 SetFS(orgtibsel);172 thdb = (THDB *)(winteb+1); 173 orgtibsel = thdb->OrgTIBSel; 174 175 //Restore our original FS selector 176 SetFS(orgtibsel); 175 177 } 176 178 } … … 185 187 winteb = (TEB *)*TIBFlatPtr; 186 188 if(winteb) { 187 thdb = (THDB *)(winteb+1);188 win32tibsel = thdb->teb_sel;189 190 //Restore our win32 FS selector191 return SetReturnFS(win32tibsel);189 thdb = (THDB *)(winteb+1); 190 win32tibsel = thdb->teb_sel; 191 192 //Restore our win32 FS selector 193 return SetReturnFS(win32tibsel); 192 194 } 193 195 // nested calls are OK, OS2ToWinCallback for instance … … 199 201 //****************************************************************************** 200 202 void WIN32API RegisterExe(WIN32EXEENTRY EntryPoint, PIMAGE_TLS_CALLBACK *TlsCallbackAddr, 201 LPDWORD TlsIndexAddr, ULONG TlsInitSize,202 ULONG TlsTotalSize, LPVOID TlsAddress,203 LONG Win32TableId, LONG NameTableId, LONG VersionResId,204 LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwReserved)203 LPDWORD TlsIndexAddr, ULONG TlsInitSize, 204 ULONG TlsTotalSize, LPVOID TlsAddress, 205 LONG Win32TableId, LONG NameTableId, LONG VersionResId, 206 LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwReserved) 205 207 { 206 208 if(WinExe != NULL) //should never happen 207 delete(WinExe); 209 ODIN_delete(WinExe); 210 208 211 209 212 CheckVersion(Pe2lxVersion, OS2GetDllName(hinstance)); … … 214 217 215 218 //SvL: Use 0 instead of the real instance handle (for resource lookup) 216 Win32Exe *winexe = new Win32Exe(0, NameTableId, Win32TableId); 219 Win32Exe *winexe; 220 221 ODIN_FS_BEGIN 222 winexe = new Win32Exe(0, NameTableId, Win32TableId); 223 ODIN_FS_END 217 224 218 225 if(winexe) { 219 dprintf(("RegisterExe Win32TableId = %x", Win32TableId));220 dprintf(("RegisterExe NameTableId = %x", NameTableId));221 dprintf(("RegisterExe VersionResId = %x", VersionResId));222 dprintf(("RegisterExe Pe2lxVersion = %x", Pe2lxVersion));223 224 winexe->setVersionId(VersionResId);225 winexe->setOS2InstanceHandle(hinstance);226 winexe->setEntryPoint((ULONG)EntryPoint);227 winexe->setTLSAddress(TlsAddress);228 winexe->setTLSInitSize(TlsInitSize);229 winexe->setTLSTotalSize(TlsTotalSize);230 winexe->setTLSIndexAddr(TlsIndexAddr);231 winexe->setTLSCallBackAddr(TlsCallbackAddr);232 233 char *modname = getenv("WIN32MODULE");234 235 if(modname != NULL)236 {237 dprintf(("Set full path for exe to %s", modname));238 winexe->setFullPath(modname);239 }240 winexe->start();226 dprintf(("RegisterExe Win32TableId = %x", Win32TableId)); 227 dprintf(("RegisterExe NameTableId = %x", NameTableId)); 228 dprintf(("RegisterExe VersionResId = %x", VersionResId)); 229 dprintf(("RegisterExe Pe2lxVersion = %x", Pe2lxVersion)); 230 231 winexe->setVersionId(VersionResId); 232 winexe->setOS2InstanceHandle(hinstance); 233 winexe->setEntryPoint((ULONG)EntryPoint); 234 winexe->setTLSAddress(TlsAddress); 235 winexe->setTLSInitSize(TlsInitSize); 236 winexe->setTLSTotalSize(TlsTotalSize); 237 winexe->setTLSIndexAddr(TlsIndexAddr); 238 winexe->setTLSCallBackAddr(TlsCallbackAddr); 239 240 char *modname = getenv("WIN32MODULE"); 241 242 if(modname != NULL) 243 { 244 dprintf(("Set full path for exe to %s", modname)); 245 winexe->setFullPath(modname); 246 } 247 winexe->start(); 241 248 } 242 249 else { 243 eprintf(("Win32Exe creation failed!\n"));244 DebugInt3();245 return;250 eprintf(("Win32Exe creation failed!\n")); 251 DebugInt3(); 252 return; 246 253 } 247 254 } … … 249 256 //****************************************************************************** 250 257 ULONG WIN32API RegisterDll(WIN32DLLENTRY pfnDllEntry, PIMAGE_TLS_CALLBACK *TlsCallbackAddr, 251 LPDWORD TlsIndexAddr, ULONG TlsInitSize,252 ULONG TlsTotalSize, LPVOID TlsAddress,253 LONG Win32TableId, LONG NameTableId, LONG VersionResId,254 LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwAttachType)258 LPDWORD TlsIndexAddr, ULONG TlsInitSize, 259 ULONG TlsTotalSize, LPVOID TlsAddress, 260 LONG Win32TableId, LONG NameTableId, LONG VersionResId, 261 LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwAttachType) 255 262 { 256 263 char *name; … … 259 266 if(dwAttachType == 0) 260 267 { //Process attach 261 if(getenv("WIN32_IOPL2")) { 262 io_init1(); 263 } 264 name = OS2GetDllName(hinstance); 265 CheckVersion(Pe2lxVersion, name); 266 267 dprintf(("RegisterDll %X %s reason %d\n", hinstance, name, dwAttachType)); 268 dprintf(("RegisterDll Win32TableId = %x", Win32TableId)); 269 dprintf(("RegisterDll NameTableId = %x", NameTableId)); 270 dprintf(("RegisterDll VersionResId = %x", VersionResId)); 271 dprintf(("RegisterDll Pe2lxVersion = %x", Pe2lxVersion)); 272 273 if(winmod != NULL) { 274 //dll manually loaded by PE loader (Win32Dll::init) 275 winmod->OS2DllInit(hinstance, NameTableId, Win32TableId, pfnDllEntry); 276 } 277 else { 278 //converted win32 dll loaded by OS/2 loader 279 winmod = new Win32Dll(hinstance, NameTableId, Win32TableId, pfnDllEntry); 280 if(winmod == NULL) { 281 eprintf(("Failed to allocate module object!\n")); 282 DebugInt3(); 283 return 0; //fail dll load 284 } 285 } 286 winmod->setTLSAddress(TlsAddress); 287 winmod->setTLSInitSize(TlsInitSize); 288 winmod->setTLSTotalSize(TlsTotalSize); 289 winmod->setTLSIndexAddr(TlsIndexAddr); 290 winmod->setTLSCallBackAddr(TlsCallbackAddr); 291 292 /* @@@PH 1998/03/17 console devices initialization */ 293 iConsoleDevicesRegister(); 294 295 //SvL: 19-8-'98 296 winmod->AddRef(); 297 winmod->setVersionId(VersionResId); 298 299 winmod->attachProcess(); 268 if(getenv("WIN32_IOPL2")) { 269 io_init1(); 270 } 271 name = OS2GetDllName(hinstance); 272 CheckVersion(Pe2lxVersion, name); 273 274 dprintf(("RegisterDll %X %s reason %d\n", hinstance, name, dwAttachType)); 275 dprintf(("RegisterDll Win32TableId = %x", Win32TableId)); 276 dprintf(("RegisterDll NameTableId = %x", NameTableId)); 277 dprintf(("RegisterDll VersionResId = %x", VersionResId)); 278 dprintf(("RegisterDll Pe2lxVersion = %x", Pe2lxVersion)); 279 280 if(winmod != NULL) { 281 //dll manually loaded by PE loader (Win32Dll::init) 282 winmod->OS2DllInit(hinstance, NameTableId, Win32TableId, pfnDllEntry); 283 } 284 else { 285 //converted win32 dll loaded by OS/2 loader 286 ODIN_FS_BEGIN 287 winmod = new Win32Dll(hinstance, NameTableId, Win32TableId, pfnDllEntry); 288 ODIN_FS_END 289 if(winmod == NULL) { 290 eprintf(("Failed to allocate module object!\n")); 291 DebugInt3(); 292 return 0; //fail dll load 293 } 294 } 295 winmod->setTLSAddress(TlsAddress); 296 winmod->setTLSInitSize(TlsInitSize); 297 winmod->setTLSTotalSize(TlsTotalSize); 298 winmod->setTLSIndexAddr(TlsIndexAddr); 299 winmod->setTLSCallBackAddr(TlsCallbackAddr); 300 301 /* @@@PH 1998/03/17 console devices initialization */ 302 iConsoleDevicesRegister(); 303 304 //SvL: 19-8-'98 305 winmod->AddRef(); 306 winmod->setVersionId(VersionResId); 307 308 winmod->attachProcess(); 300 309 } 301 310 else {//process detach 302 if(winmod != NULL && !fFreeLibrary) {303 return 0;//don't unload (OS/2 dll unload bug)304 }311 if(winmod != NULL && !fFreeLibrary) { 312 return 0; //don't unload (OS/2 dll unload bug) 313 } 305 314 //Runtime environment could already be gone, so don't do this 306 // dprintf(("KERNEL32: Dll Removed by FreeLibrary or ExitProcess\n"));307 } 308 return 1; //success315 // dprintf(("KERNEL32: Dll Removed by FreeLibrary or ExitProcess\n")); 316 } 317 return 1; //success 309 318 } 310 319 //****************************************************************************** … … 315 324 316 325 if(WinExe) { 317 delete WinExe;326 ODIN_delete(WinExe); 318 327 WinExe = NULL; 319 328 } … … 386 395 return module->getInstanceHandle(); 387 396 } 397 398 ODIN_FS_BEGIN 388 399 module = new Win32Dll((char *)lpszLibFile); 400 ODIN_FS_END 389 401 if(module == NULL) 390 402 return(0); … … 393 405 if(module->getError() != NO_ERROR) { 394 406 dprintf(("LoadLibary %s failed (::init)\n", lpszLibFile)); 395 delete module;407 ODIN_delete(module); 396 408 return(0); 397 409 } 398 410 if(module->attachProcess() == FALSE) { 399 411 dprintf(("LoadLibary %s failed (::attachProcess)\n", lpszLibFile)); 400 delete module;412 ODIN_delete(module); 401 413 return(0); 402 414 } … … 456 468 return module->getInstanceHandle(); 457 469 } 470 471 ODIN_FS_BEGIN 458 472 module = new Win32Dll((char *)lpszLibFile); 473 ODIN_FS_END 474 459 475 if(module == NULL) 460 476 return(0); … … 463 479 if(module->getError() != NO_ERROR) { 464 480 dprintf(("LoadLibary %s failed (::init)\n", lpszLibFile)); 465 delete module;481 ODIN_delete(module); 466 482 return(0); 467 483 } … … 471 487 if(module->attachProcess() == FALSE) { 472 488 dprintf(("LoadLibary %s failed (::attachProcess)\n", lpszLibFile)); 473 delete module;489 ODIN_delete(module); 474 490 return(0); 475 491 } … … 534 550 535 551 if(WinExe) { 536 asciicmdline = WinExe->getCommandLine();552 asciicmdline = WinExe->getCommandLine(); 537 553 } 538 554 if(asciicmdline == NULL) //not used for converted exes 539 asciicmdline = O32_GetCommandLine();555 asciicmdline = O32_GetCommandLine(); 540 556 541 557 if(asciicmdline) { … … 595 611 //****************************************************************************** 596 612 BOOL WIN32API CreateProcessA(LPCSTR lpszImageName, LPSTR lpszCommandLine, 597 PSECURITY_ATTRIBUTES arg3,613 PSECURITY_ATTRIBUTES arg3, 598 614 PSECURITY_ATTRIBUTES arg4, BOOL arg5, DWORD arg6, 599 615 PVOID arg7, LPCSTR arg8, LPSTARTUPINFOA arg9, -
trunk/src/odincrt/makefile
r443 r461 1 # $Id: makefile,v 1. 2 1999-08-09 18:10:50 achimhaExp $1 # $Id: makefile,v 1.3 1999-08-09 22:10:09 phaller Exp $ 2 2 3 3 # … … 37 37 38 38 39 odincrt.obj: odincrt.cpp odincrt.h39 odincrt.obj: odincrt.cpp $(PDWIN32_INCLUDE)\odincrt.h 40 40 initterm.obj: initterm.cpp 41 41 odinfs.obj: odinfs.asm
Note:
See TracChangeset
for help on using the changeset viewer.
