Changeset 532 for trunk/src/kernel32
- Timestamp:
- Aug 17, 1999, 7:04:52 PM (26 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/HandleManager.cpp
r529 r532 1 /* $Id: HandleManager.cpp,v 1. 9 1999-08-17 16:35:08 phallerExp $ */1 /* $Id: HandleManager.cpp,v 1.10 1999-08-17 17:04:50 sandervl Exp $ */ 2 2 3 3 /* -
trunk/src/kernel32/KERNEL32.CPP
r529 r532 1 /* $Id: KERNEL32.CPP,v 1.13 1999-08-17 16:35:09 phaller Exp $ */ 2 3 /* 4 * 5 * Project Odin Software License can be found in LICENSE.TXT 6 * 7 */ 1 /* $Id: KERNEL32.CPP,v 1.14 1999-08-17 17:04:51 sandervl Exp $ */ 2 8 3 /* 9 4 * Win32 compatibility file functions for OS/2 … … 15 10 * 16 11 * @(#) KERNEL32.CPP 1.0.1 1998/06/12 PH added HandleManager support 12 * 13 * Project Odin Software License can be found in LICENSE.TXT 14 * 17 15 */ 18 16 … … 26 24 #include <stdlib.h> 27 25 #include <string.h> 28 //#include <odincrt.h>29 26 30 27 #include "misc.h" -
trunk/src/kernel32/heap.cpp
r529 r532 1 /* $Id: heap.cpp,v 1.1 2 1999-08-17 16:35:09 phallerExp $ */1 /* $Id: heap.cpp,v 1.13 1999-08-17 17:04:51 sandervl Exp $ */ 2 2 3 3 /* … … 70 70 if(curheap == NULL) 71 71 { 72 O32_HeapDestroy(hHeap);72 O32_HeapDestroy(hHeap); 73 73 return(NULL); 74 74 } … … 92 92 93 93 O32_HeapDestroy(curheap->getHeapHandle()); 94 delete curheap;94 delete(curheap); 95 95 return(TRUE); 96 96 } … … 157 157 158 158 if(OS2ProcessHeap == NULL) { 159 O32_HeapDestroy(hHeap);160 return(NULL);159 O32_HeapDestroy(hHeap); 160 return(NULL); 161 161 } 162 162 processheap = hHeap; -
trunk/src/kernel32/os2heap.cpp
r529 r532 1 /* $Id: os2heap.cpp,v 1. 7 1999-08-17 16:35:09 phallerExp $ */1 /* $Id: os2heap.cpp,v 1.8 1999-08-17 17:04:51 sandervl Exp $ */ 2 2 3 3 /* … … 91 91 { 92 92 hmutex->leave(); 93 delete hmutex;93 delete(hmutex); 94 94 } 95 95 -
trunk/src/kernel32/thread.cpp
r529 r532 1 /* $Id: thread.cpp,v 1. 9 1999-08-17 16:35:10 phallerExp $ */1 /* $Id: thread.cpp,v 1.10 1999-08-17 17:04:52 sandervl Exp $ */ 2 2 3 3 /* … … 12 12 #include <os2win.h> 13 13 #include <stdarg.h> 14 //#include <odincrt.h>15 14 #include "thread.h" 16 15 #include "except.h" … … 160 159 DWORD rc; 161 160 162 delete(me); //only called once 163 161 delete(me); //only called once 164 162 dprintf(("Win32ThreadProc %d\n", GetCurrentThreadId())); 165 163 -
trunk/src/kernel32/winimage.cpp
r529 r532 1 /* $Id: winimage.cpp,v 1. 8 1999-08-17 16:35:10 phallerExp $ */1 /* $Id: winimage.cpp,v 1.9 1999-08-17 17:04:52 sandervl Exp $ */ 2 2 3 3 /* … … 144 144 { 145 145 res = winres->next; 146 delete winres;146 delete(winres); 147 147 winres = res; 148 148 } … … 985 985 if(WinDll == NULL) { 986 986 fout << "WinDll: Error allocating memory" << endl; 987 987 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szMemErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE); 988 988 errorState = ERROR_INTERNAL; 989 989 return(FALSE); -
trunk/src/kernel32/winimgres.cpp
r529 r532 1 /* $Id: winimgres.cpp,v 1.6 1999-08-17 16:35:11 phaller Exp $ */ 2 3 /* 4 * 5 * Project Odin Software License can be found in LICENSE.TXT 6 * 7 */ 1 /* $Id: winimgres.cpp,v 1.7 1999-08-17 17:04:52 sandervl Exp $ */ 2 8 3 /* 9 4 * Win32 PE Image class (resource methods) 10 5 * 11 6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl) 7 * 8 * 9 * Project Odin Software License can be found in LICENSE.TXT 12 10 * 13 11 */ … … 160 158 unicodestr += *unicodestr; 161 159 } 162 163 160 res = new Win32Resource(this, id, NTRT_STRING, (ULONG)*unicodestr, (char *)unicodestr); 164 161 if(res == NULL) { … … 167 164 } 168 165 } 169 else 170 res = new Win32Resource(this, id, type, pData->Size, resdata); 166 else res = new Win32Resource(this, id, type, pData->Size, resdata); 171 167 172 168 return res; -
trunk/src/kernel32/wprocess.cpp
r529 r532 1 /* $Id: wprocess.cpp,v 1. 19 1999-08-17 16:35:11 phallerExp $ */1 /* $Id: wprocess.cpp,v 1.20 1999-08-17 17:04:52 sandervl Exp $ */ 2 2 3 3 /* … … 14 14 #include <stdlib.h> 15 15 #include <string.h> 16 #include <odinwrap.h>17 16 18 17 #include "unicode.h" … … 37 36 //Process database 38 37 PDB ProcessPDB = {0}; 39 USHORT 38 USHORT ProcessTIBSel = 0; 40 39 DWORD *TIBFlatPtr = 0; 41 40 … … 77 76 TIBFlatPtr = (DWORD *)OS2AllocThreadLocalMemory(1); 78 77 if(TIBFlatPtr == 0) { 79 dprintf(("InitializeTIB: local thread memory alloc failed!!"));80 DebugInt3();81 return NULL;78 dprintf(("InitializeTIB: local thread memory alloc failed!!")); 79 DebugInt3(); 80 return NULL; 82 81 } 83 82 if(OS2AllocSel(PAGE_SIZE, &tibsel) == FALSE) 84 83 { 85 dprintf(("InitializeTIB: selector alloc failed!!"));86 DebugInt3();87 return NULL;84 dprintf(("InitializeTIB: selector alloc failed!!")); 85 DebugInt3(); 86 return NULL; 88 87 } 89 88 winteb = (TEB *)OS2SelToFlat(tibsel); 90 89 if(winteb == NULL) 91 90 { 92 dprintf(("InitializeTIB: DosSelToFlat failed!!"));93 DebugInt3();94 return NULL;91 dprintf(("InitializeTIB: DosSelToFlat failed!!")); 92 DebugInt3(); 93 return NULL; 95 94 } 96 95 memset(winteb, 0, PAGE_SIZE); … … 117 116 if(OS2GetPIB(PIB_TASKTYPE) == TASKTYPE_PM) 118 117 { 119 thdb->flags = 0; //todo gui120 } 121 else 118 thdb->flags = 0; //todo gui 119 } 120 else thdb->flags = 0; //todo textmode 122 121 123 122 if(fMainThread) 124 123 { 125 //todo initialize PDB during process creation124 //todo initialize PDB during process creation 126 125 //todo: initialize TLS array if required 127 126 //TLS in executable always TLS index 0? 128 ProcessTIBSel = tibsel;127 ProcessTIBSel = tibsel; 129 128 } 130 129 dprintf(("InitializeTIB setup TEB with selector %x", tibsel)); … … 146 145 winteb = (TEB *)*TIBFlatPtr; 147 146 if(winteb) { 148 thdb = (THDB *)(winteb+1);149 orgtibsel = thdb->OrgTIBSel;150 151 //Restore our original FS selector152 SetFS(orgtibsel);153 154 //And free our own155 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); 156 155 } 157 156 else dprintf(("Already destroyed TIB")); … … 171 170 winteb = (TEB *)*TIBFlatPtr; 172 171 if(winteb) { 173 thdb = (THDB *)(winteb+1);174 orgtibsel = thdb->OrgTIBSel;175 176 //Restore our original FS selector177 SetFS(orgtibsel);172 thdb = (THDB *)(winteb+1); 173 orgtibsel = thdb->OrgTIBSel; 174 175 //Restore our original FS selector 176 SetFS(orgtibsel); 178 177 } 179 178 } … … 188 187 winteb = (TEB *)*TIBFlatPtr; 189 188 if(winteb) { 190 thdb = (THDB *)(winteb+1);191 win32tibsel = thdb->teb_sel;192 193 //Restore our win32 FS selector194 return SetReturnFS(win32tibsel);189 thdb = (THDB *)(winteb+1); 190 win32tibsel = thdb->teb_sel; 191 192 //Restore our win32 FS selector 193 return SetReturnFS(win32tibsel); 195 194 } 196 195 // nested calls are OK, OS2ToWinCallback for instance … … 202 201 //****************************************************************************** 203 202 void WIN32API RegisterExe(WIN32EXEENTRY EntryPoint, PIMAGE_TLS_CALLBACK *TlsCallbackAddr, 204 LPDWORD TlsIndexAddr, ULONG TlsInitSize,205 ULONG TlsTotalSize, LPVOID TlsAddress,206 LONG Win32TableId, LONG NameTableId, LONG VersionResId,207 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) 208 207 { 209 208 if(WinExe != NULL) //should never happen 210 delete WinExe; 211 209 delete(WinExe); 212 210 213 211 CheckVersion(Pe2lxVersion, OS2GetDllName(hinstance)); … … 223 221 224 222 if(winexe) { 225 dprintf(("RegisterExe Win32TableId = %x", Win32TableId));226 dprintf(("RegisterExe NameTableId = %x", NameTableId));227 dprintf(("RegisterExe VersionResId = %x", VersionResId));228 dprintf(("RegisterExe Pe2lxVersion = %x", Pe2lxVersion));229 230 winexe->setVersionId(VersionResId);231 winexe->setOS2InstanceHandle(hinstance);232 winexe->setEntryPoint((ULONG)EntryPoint);233 winexe->setTLSAddress(TlsAddress);234 winexe->setTLSInitSize(TlsInitSize);235 winexe->setTLSTotalSize(TlsTotalSize);236 winexe->setTLSIndexAddr(TlsIndexAddr);237 winexe->setTLSCallBackAddr(TlsCallbackAddr);238 239 char *modname = getenv("WIN32MODULE");240 241 if(modname != NULL)242 {243 dprintf(("Set full path for exe to %s", modname));244 winexe->setFullPath(modname);245 }246 winexe->start();223 dprintf(("RegisterExe Win32TableId = %x", Win32TableId)); 224 dprintf(("RegisterExe NameTableId = %x", NameTableId)); 225 dprintf(("RegisterExe VersionResId = %x", VersionResId)); 226 dprintf(("RegisterExe Pe2lxVersion = %x", Pe2lxVersion)); 227 228 winexe->setVersionId(VersionResId); 229 winexe->setOS2InstanceHandle(hinstance); 230 winexe->setEntryPoint((ULONG)EntryPoint); 231 winexe->setTLSAddress(TlsAddress); 232 winexe->setTLSInitSize(TlsInitSize); 233 winexe->setTLSTotalSize(TlsTotalSize); 234 winexe->setTLSIndexAddr(TlsIndexAddr); 235 winexe->setTLSCallBackAddr(TlsCallbackAddr); 236 237 char *modname = getenv("WIN32MODULE"); 238 239 if(modname != NULL) 240 { 241 dprintf(("Set full path for exe to %s", modname)); 242 winexe->setFullPath(modname); 243 } 244 winexe->start(); 247 245 } 248 246 else { 249 eprintf(("Win32Exe creation failed!\n"));250 DebugInt3();251 return;247 eprintf(("Win32Exe creation failed!\n")); 248 DebugInt3(); 249 return; 252 250 } 253 251 } … … 255 253 //****************************************************************************** 256 254 ULONG WIN32API RegisterDll(WIN32DLLENTRY pfnDllEntry, PIMAGE_TLS_CALLBACK *TlsCallbackAddr, 257 LPDWORD TlsIndexAddr, ULONG TlsInitSize,258 ULONG TlsTotalSize, LPVOID TlsAddress,259 LONG Win32TableId, LONG NameTableId, LONG VersionResId,260 LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwAttachType)255 LPDWORD TlsIndexAddr, ULONG TlsInitSize, 256 ULONG TlsTotalSize, LPVOID TlsAddress, 257 LONG Win32TableId, LONG NameTableId, LONG VersionResId, 258 LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwAttachType) 261 259 { 262 260 char *name; … … 265 263 if(dwAttachType == 0) 266 264 { //Process attach 267 if(getenv("WIN32_IOPL2")) {268 io_init1();269 }270 name = OS2GetDllName(hinstance);271 CheckVersion(Pe2lxVersion, name);272 273 dprintf(("RegisterDll %X %s reason %d\n", hinstance, name, dwAttachType));274 dprintf(("RegisterDll Win32TableId = %x", Win32TableId));275 dprintf(("RegisterDll NameTableId = %x", NameTableId));276 dprintf(("RegisterDll VersionResId = %x", VersionResId));277 dprintf(("RegisterDll Pe2lxVersion = %x", Pe2lxVersion));278 279 if(winmod != NULL) {280 //dll manually loaded by PE loader (Win32Dll::init)281 winmod->OS2DllInit(hinstance, NameTableId, Win32TableId, pfnDllEntry);282 }283 else {284 //converted win32 dll loaded by OS/2 loader285 winmod = new Win32Dll(hinstance, NameTableId, Win32TableId, pfnDllEntry);286 if(winmod == NULL) {287 eprintf(("Failed to allocate module object!\n"));288 DebugInt3();289 return 0; //fail dll load290 }291 }292 winmod->setTLSAddress(TlsAddress);293 winmod->setTLSInitSize(TlsInitSize);294 winmod->setTLSTotalSize(TlsTotalSize);295 winmod->setTLSIndexAddr(TlsIndexAddr);296 winmod->setTLSCallBackAddr(TlsCallbackAddr);297 298 /* @@@PH 1998/03/17 console devices initialization */299 iConsoleDevicesRegister();300 301 //SvL: 19-8-'98302 winmod->AddRef();303 winmod->setVersionId(VersionResId);304 305 winmod->attachProcess();265 if(getenv("WIN32_IOPL2")) { 266 io_init1(); 267 } 268 name = OS2GetDllName(hinstance); 269 CheckVersion(Pe2lxVersion, name); 270 271 dprintf(("RegisterDll %X %s reason %d\n", hinstance, name, dwAttachType)); 272 dprintf(("RegisterDll Win32TableId = %x", Win32TableId)); 273 dprintf(("RegisterDll NameTableId = %x", NameTableId)); 274 dprintf(("RegisterDll VersionResId = %x", VersionResId)); 275 dprintf(("RegisterDll Pe2lxVersion = %x", Pe2lxVersion)); 276 277 if(winmod != NULL) { 278 //dll manually loaded by PE loader (Win32Dll::init) 279 winmod->OS2DllInit(hinstance, NameTableId, Win32TableId, pfnDllEntry); 280 } 281 else { 282 //converted win32 dll loaded by OS/2 loader 283 winmod = new Win32Dll(hinstance, NameTableId, Win32TableId, pfnDllEntry); 284 if(winmod == NULL) { 285 eprintf(("Failed to allocate module object!\n")); 286 DebugInt3(); 287 return 0; //fail dll load 288 } 289 } 290 winmod->setTLSAddress(TlsAddress); 291 winmod->setTLSInitSize(TlsInitSize); 292 winmod->setTLSTotalSize(TlsTotalSize); 293 winmod->setTLSIndexAddr(TlsIndexAddr); 294 winmod->setTLSCallBackAddr(TlsCallbackAddr); 295 296 /* @@@PH 1998/03/17 console devices initialization */ 297 iConsoleDevicesRegister(); 298 299 //SvL: 19-8-'98 300 winmod->AddRef(); 301 winmod->setVersionId(VersionResId); 302 303 winmod->attachProcess(); 306 304 } 307 305 else {//process detach 308 if(winmod != NULL && !fFreeLibrary) {309 return 0; //don't unload (OS/2 dll unload bug)310 }311 //Runtime environment could already be gone, so don't do this312 // dprintf(("KERNEL32: Dll Removed by FreeLibrary or ExitProcess\n"));306 if(winmod != NULL && !fFreeLibrary) { 307 return 0; //don't unload (OS/2 dll unload bug) 308 } 309 //Runtime environment could already be gone, so don't do this 310 // dprintf(("KERNEL32: Dll Removed by FreeLibrary or ExitProcess\n")); 313 311 } 314 312 return 1; //success … … 321 319 322 320 if(WinExe) { 323 delete WinExe;321 delete(WinExe); 324 322 WinExe = NULL; 325 323 } … … 400 398 if(module->getError() != NO_ERROR) { 401 399 dprintf(("LoadLibary %s failed (::init)\n", lpszLibFile)); 402 delete module;400 delete(module); 403 401 return(0); 404 402 } 405 403 if(module->attachProcess() == FALSE) { 406 404 dprintf(("LoadLibary %s failed (::attachProcess)\n", lpszLibFile)); 407 delete module;405 delete(module); 408 406 return(0); 409 407 } … … 465 463 466 464 module = new Win32Dll((char *)lpszLibFile); 465 467 466 if(module == NULL) 468 467 return(0); … … 471 470 if(module->getError() != NO_ERROR) { 472 471 dprintf(("LoadLibary %s failed (::init)\n", lpszLibFile)); 473 delete module;472 delete(module); 474 473 return(0); 475 474 } … … 479 478 if(module->attachProcess() == FALSE) { 480 479 dprintf(("LoadLibary %s failed (::attachProcess)\n", lpszLibFile)); 481 delete module;480 delete(module); 482 481 return(0); 483 482 }
Note:
See TracChangeset
for help on using the changeset viewer.