- Timestamp:
- Oct 6, 2000, 1:04:02 PM (25 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/KERNEL32.DEF
r4363 r4440 1 ; $Id: KERNEL32.DEF,v 1.8 7 2000-10-02 13:05:36 phallerExp $1 ; $Id: KERNEL32.DEF,v 1.88 2000-10-06 11:04:00 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 1033 1033 _RegisterPe2LxDll@12 @1209 1034 1034 1035 _CreateWin32PeLdrExe@1 2@12361035 _CreateWin32PeLdrExe@16 @1236 1036 1036 1037 1037 _RegisterLxExe@8 @1237 -
trunk/src/kernel32/message.cpp
r3804 r4440 1 /* $Id: message.cpp,v 1.1 1 2000-07-06 21:18:43sandervl Exp $ */1 /* $Id: message.cpp,v 1.12 2000-10-06 11:04:01 sandervl Exp $ */ 2 2 3 3 /* … … 174 174 INT bufsize; 175 175 176 //SvL/MN: VACPPWIN uses message ids > 64k!! 177 #ifndef __WIN32OS2__ 176 178 dwMessageId &= 0xFFFF; 179 #endif 177 180 bufsize=LoadMessageA((HMODULE)lpSource,dwMessageId,dwLanguageId,NULL,100); 178 181 if (bufsize) … … 405 408 INT bufsize; 406 409 410 //SvL/MN: VACPPWIN uses message ids > 64k!! 411 #ifndef __WIN32OS2__ 407 412 dwMessageId &= 0xFFFF; 413 #endif 408 414 bufsize=LoadMessageA((HMODULE)lpSource,dwMessageId,dwLanguageId,NULL,100); 409 415 if (bufsize) -
trunk/src/kernel32/pefile.cpp
r3759 r4440 1 /* $Id: pefile.cpp,v 1. 9 2000-06-26 13:21:34sandervl Exp $ */1 /* $Id: pefile.cpp,v 1.10 2000-10-06 11:04:01 sandervl Exp $ */ 2 2 3 3 /* … … 104 104 //****************************************************************************** 105 105 //****************************************************************************** 106 BOOL Is ImportSection(LPVOID lpFile, PIMAGE_SECTION_HEADER psh)106 BOOL IsSectionType(LPVOID lpFile, PIMAGE_SECTION_HEADER psh, DWORD dwIMAGE_DIRECTORY) 107 107 { 108 108 PIMAGE_OPTIONAL_HEADER poh = (PIMAGE_OPTIONAL_HEADER)OPTHEADEROFF (lpFile); … … 110 110 DWORD ImageDirVA; 111 111 112 ImageDirVA = poh->DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;112 ImageDirVA = poh->DataDirectory[dwIMAGE_DIRECTORY].VirtualAddress; 113 113 114 114 if(psh->VirtualAddress <= ImageDirVA && 115 psh->VirtualAddress + max(psh->Misc.VirtualSize,psh->SizeOfRawData) > ImageDirVA && 116 strcmp(psh->Name, ".idata") == 0) 115 psh->VirtualAddress + max(psh->Misc.VirtualSize,psh->SizeOfRawData) > ImageDirVA) 117 116 { 118 117 return TRUE; -
trunk/src/kernel32/winexebase.cpp
r4244 r4440 1 /* $Id: winexebase.cpp,v 1.1 1 2000-09-12 19:01:59sandervl Exp $ */1 /* $Id: winexebase.cpp,v 1.12 2000-10-06 11:04:01 sandervl Exp $ */ 2 2 3 3 /* … … 115 115 //Set default FPU control word (no exceptions); same as in NT 116 116 _control87(0x27F, 0xFFF); 117 #if 0 117 118 ULONG Size = 16, Attr; 118 119 rc = DosQueryMem((PVOID) (entryPoint), &Size, &Attr); 119 120 dprintf(("Start exe; Attr = %x, rc = %d", Attr, rc)); 121 #else 122 dprintf(("Start exe")); 123 #endif 120 124 rc = ((WIN32EXEENTRY)entryPoint)(NULL); 121 125 RestoreOS2TIB(); -
trunk/src/kernel32/winexepeldr.cpp
r4351 r4440 1 /* $Id: winexepeldr.cpp,v 1.1 1 2000-10-01 12:05:57sandervl Exp $ */1 /* $Id: winexepeldr.cpp,v 1.12 2000-10-06 11:04:01 sandervl Exp $ */ 2 2 3 3 /* … … 47 47 //Called by ring 3 pe loader to create win32 executable 48 48 //****************************************************************************** 49 BOOL WIN32API CreateWin32PeLdrExe(char *szFileName, char *szCmdLine, ULONG reservedMem) 49 BOOL WIN32API CreateWin32PeLdrExe(char *szFileName, char *szCmdLine, 50 ULONG reservedMem, BOOL fConsoleApp) 50 51 { 51 52 APIRET rc; … … 58 59 fPeLoader = TRUE; 59 60 60 WinExe = new Win32PeLdrExe(szFileName );61 WinExe = new Win32PeLdrExe(szFileName, fConsoleApp); 61 62 62 63 rc = DosGetInfoBlocks(&ptib, &ppib); … … 81 82 82 83 if(getenv("WIN32_IOPL2")) { 83 io_init1();84 io_init1(); 84 85 } 85 86 OS2SetExceptionHandler(&exceptFrame); 87 if(WinExe->init(reservedMem) == FALSE) { 88 if(szErrorModule[0] != 0) { 89 char szErrorMsg[128]; 90 91 sprintf(szErrorMsg, "Can't execute %s due to bad or missing %s", OSLibStripPath(szFileName), szErrorModule); 92 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE); 93 } 94 delete WinExe; 95 return FALSE; 96 } 97 98 OS2UnsetExceptionHandler(&exceptFrame); 99 if(WinExe->isConsoleApp()) { 86 //Init console before loading executable as dlls might want to print 87 //something on the console while being loaded 88 if(WinExe->isConsoleApp()) 89 { 100 90 dprintf(("Console application!\n")); 101 91 … … 104 94 dprintf(("KERNEL32:Win32Image:Init ConsoleInit failed with %u.\n", rc)); 105 95 } 96 97 OS2SetExceptionHandler(&exceptFrame); 98 if(WinExe->init(reservedMem) == FALSE) 99 { 100 if(szErrorModule[0] != 0) { 101 char szErrorMsg[128]; 102 103 sprintf(szErrorMsg, "Can't execute %s due to bad or missing %s", OSLibStripPath(szFileName), szErrorModule); 104 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE); 105 } 106 delete WinExe; 107 OS2UnsetExceptionHandler(&exceptFrame); 108 return FALSE; 109 } 110 OS2UnsetExceptionHandler(&exceptFrame); 106 111 107 112 WinExe->start(); … … 113 118 //****************************************************************************** 114 119 //****************************************************************************** 115 Win32PeLdrExe::Win32PeLdrExe(char *szFileName ) :120 Win32PeLdrExe::Win32PeLdrExe(char *szFileName, BOOL fConsoleApp) : 116 121 Win32ImageBase(-1), 117 122 Win32ExeBase(-1), … … 119 124 { 120 125 dprintf(("Win32PeLdrExe ctor: %s", szFileName)); 126 this->fConsoleApp = fConsoleApp; 127 128 //SvL: set temporary full path here as console init needs it 129 setFullPath(szFileName); 121 130 } 122 131 //****************************************************************************** … … 132 141 133 142 rc = Win32PeLdrImage::init(reservedMem); 134 fConsoleApp = (oh.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI);135 143 return rc; 136 144 } -
trunk/src/kernel32/winexepeldr.h
r3375 r4440 1 /* $Id: winexepeldr.h,v 1. 2 2000-04-14 22:35:28sandervl Exp $ */1 /* $Id: winexepeldr.h,v 1.3 2000-10-06 11:04:02 sandervl Exp $ */ 2 2 3 3 /* … … 16 16 #include <winimagepeldr.h> 17 17 18 typedef BOOL (* WIN32API WIN32CTOR)(char *, char *, ULONG );18 typedef BOOL (* WIN32API WIN32CTOR)(char *, char *, ULONG, BOOL); 19 19 20 20 //Class for executables run by the ring 3 PE loader … … 22 22 { 23 23 public: 24 Win32PeLdrExe(char *szFileName );24 Win32PeLdrExe(char *szFileName, BOOL fConsoleApp); 25 25 virtual ~Win32PeLdrExe(); 26 26 -
trunk/src/kernel32/winimagebase.cpp
r4279 r4440 1 /* $Id: winimagebase.cpp,v 1.2 7 2000-09-18 19:26:16sandervl Exp $ */1 /* $Id: winimagebase.cpp,v 1.28 2000-10-06 11:04:02 sandervl Exp $ */ 2 2 3 3 /* … … 85 85 void Win32ImageBase::setFullPath(char *name) 86 86 { 87 dassert(name, ("setFullPath, name == NULL")); 87 if(fullpath) 88 free(fullpath); 88 89 fullpath = (char *)malloc(strlen(name)+1); 89 dassert(fullpath, ("setFullPath, fullpath == NULL"));90 90 strcpy(fullpath, name); 91 91 } -
trunk/src/kernel32/winimagepeldr.cpp
r4422 r4440 1 /* $Id: winimagepeldr.cpp,v 1.5 5 2000-10-04 19:36:25sandervl Exp $ */1 /* $Id: winimagepeldr.cpp,v 1.56 2000-10-06 11:04:02 sandervl Exp $ */ 2 2 3 3 /* … … 287 287 if ((psh = (PIMAGE_SECTION_HEADER)SECTIONHDROFF (win32file)) != NULL) { 288 288 dprintf((LOG, "*************************PE SECTIONS START**************************" )); 289 for (i=0; i<nSections; i++) { 289 for (i=0; i<nSections; i++) 290 { 290 291 dprintf((LOG, "Raw data size: %x", psh[i].SizeOfRawData )); 291 292 dprintf((LOG, "Virtual Address: %x", psh[i].VirtualAddress )); … … 295 296 dprintf((LOG, "Pointer to raw data: %x", psh[i].PointerToRawData )); 296 297 dprintf((LOG, "Section flags: %x\n\n", psh[i].Characteristics )); 297 if(strcmp(psh[i].Name, ".reloc") == 0) { 298 299 if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_BASERELOC)) 300 { 298 301 dprintf((LOG, ".reloc" )); 299 302 addSection(SECTION_RELOC, psh[i].PointerToRawData, … … 302 305 continue; 303 306 } 304 if(strcmp(psh[i].Name, ".edata") == 0) { 307 if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_EXPORT)) 308 { 305 309 dprintf((LOG, ".edata" )); 306 310 addSection(SECTION_EXPORT, psh[i].PointerToRawData, … … 309 313 continue; 310 314 } 311 if(strcmp(psh[i].Name, ".rsrc") == 0) { 315 if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_RESOURCE)) 316 { 312 317 dprintf((LOG, ".rsrc" )); 313 318 addSection(SECTION_RESOURCE, psh[i].PointerToRawData, … … 316 321 continue; 317 322 } 318 if(strcmp(psh[i].Name, ".tls") == 0)323 if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_TLS)) 319 324 { 320 325 tlsDir = (IMAGE_TLS_DIRECTORY *)ImageDirectoryOffset(win32file, IMAGE_DIRECTORY_ENTRY_TLS); … … 326 331 continue; 327 332 } 328 329 if(strcmp(psh[i].Name, ".debug") == 0){333 if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_DEBUG)) 334 { 330 335 dprintf((LOG, ".rdebug" )); 331 336 addSection(SECTION_DEBUG, psh[i].PointerToRawData, … … 334 339 continue; 335 340 } 336 if(Is ImportSection(win32file, &psh[i]))341 if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_IMPORT)) 337 342 { 338 int type = SECTION_IMPORT; 343 int type = SECTION_IMPORT; 344 339 345 dprintf((LOG, "Import Data Section" )); 340 346 if(psh[i].Characteristics & IMAGE_SCN_CNT_CODE) { … … 348 354 } 349 355 350 351 if( 352 353 356 //KSO Sun 1998-08-09: Borland does not alway set the CODE flag for its "CODE" section 357 if(psh[i].Characteristics & IMAGE_SCN_CNT_CODE || 358 (psh[i].Characteristics & IMAGE_SCN_MEM_EXECUTE && 359 !(psh[i].Characteristics & (IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_CNT_INITIALIZED_DATA))) //KSO: make sure its not marked as a datasection 354 360 ) 355 361 { … … 394 400 } 395 401 else { 396 if(GetSectionHdrByName (win32file, &sh, ".rsrc"))402 if(GetSectionHdrByImageDir(win32file, IMAGE_DIRECTORY_ENTRY_RESOURCE, &sh)) 397 403 { 398 404 addSection(SECTION_RESOURCE, sh.PointerToRawData, … … 539 545 //PH: get pResRootDir pointer correct first, since processImports may 540 546 // implicitly call functions depending on it. 541 if(GetSectionHdrBy Name (win32file, &sh, ".rsrc")) {547 if(GetSectionHdrByImageDir(win32file, IMAGE_DIRECTORY_ENTRY_RESOURCE, &sh)) { 542 548 //get offset in resource object of directory entry 543 549 pResRootDir = (PIMAGE_RESOURCE_DIRECTORY)(sh.VirtualAddress + realBaseAddress);
Note:
See TracChangeset
for help on using the changeset viewer.