Changeset 1872 for trunk/src/kernel32/winimagepeldr.cpp
- Timestamp:
- Nov 29, 1999, 1:05:03 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagepeldr.cpp
r1853 r1872 1 /* $Id: winimagepeldr.cpp,v 1.1 8 1999-11-27 00:05:39 sandervlExp $ */1 /* $Id: winimagepeldr.cpp,v 1.19 1999-11-29 00:04:06 bird Exp $ */ 2 2 3 3 /* … … 279 279 nSections = NR_SECTIONS(win32file); 280 280 281 if(loadType == REAL_LOAD) 281 if(loadType == REAL_LOAD) 282 282 { 283 283 imageSize = 0; … … 389 389 } 390 390 else { 391 if(GetSectionHdrByName (win32file, &sh, ".rsrc")) 391 if(GetSectionHdrByName (win32file, &sh, ".rsrc")) 392 392 { 393 393 addSection(SECTION_RESOURCE, sh.PointerToRawData, … … 407 407 imageSize = imageVirtEnd - oh.ImageBase; 408 408 } 409 if(imageSize < oh.SizeOfImage) { 409 if(imageSize < oh.SizeOfImage) { 410 410 imageSize = oh.SizeOfImage; 411 411 } … … 416 416 } 417 417 else { 418 fout << "EntryPoint == NULL" << endl; 418 fout << "EntryPoint == NULL" << endl; 419 419 entryPoint = NULL; 420 420 } … … 426 426 } 427 427 428 if(loadType == REAL_LOAD) 428 if(loadType == REAL_LOAD) 429 429 { 430 430 if(tlsDir != NULL) { … … 485 485 //get offset in resource object of directory entry 486 486 pResDir = (PIMAGE_RESOURCE_DIRECTORY)(sh.VirtualAddress + realBaseAddress); 487 pResourceSectionStart= sh.VirtualAddress;488 } 489 490 if (loadType == REAL_LOAD) 487 ulRVAResourceSection = sh.VirtualAddress; 488 } 489 490 if (loadType == REAL_LOAD) 491 491 { 492 492 if(processImports((char *)win32file) == FALSE) { … … 495 495 } 496 496 } 497 497 498 498 return(TRUE); 499 499 failure: … … 543 543 fileoffset = section->rawoffset + section->rawsize + offset; 544 544 } 545 } 545 } 546 546 else { 547 547 protflags = section->pageflags; … … 552 552 size = 0; 553 553 fileoffset = -1; 554 } 554 } 555 555 else { 556 556 size = section->rawsize-offset; … … 709 709 } 710 710 } 711 if(index == -1) 711 if(index == -1) 712 712 return NULL; 713 713 … … 804 804 805 805 for(i=0;i<nrsections;i++) { 806 switch(section[i].type) 806 switch(section[i].type) 807 807 { 808 808 case SECTION_CODE: … … 855 855 int fixupsize = 0; 856 856 857 switch(type) 857 switch(type) 858 858 { 859 859 case IMAGE_REL_BASED_HIGHLOW: … … 864 864 fixupsize = 2; 865 865 break; 866 } 867 //If the fixup crosses the final page boundary, 868 //then we have to load another page 869 if(prel->VirtualAddress + offset + fixupsize > virtAddress + size) 866 } 867 //If the fixup crosses the final page boundary, 868 //then we have to load another page 869 if(prel->VirtualAddress + offset + fixupsize > virtAddress + size) 870 870 { 871 871 newpage = realBaseAddress + prel->VirtualAddress + offset + fixupsize; … … 877 877 dprintf(("::setFixups -> section == NULL!!")); 878 878 return FALSE; 879 } 879 } 880 880 //SvL: Read page from disk 881 881 commitPage(newpage, TRUE, SINGLE_PAGE); … … 885 885 } 886 886 887 switch(type) 887 switch(type) 888 888 { 889 889 case IMAGE_REL_BASED_ABSOLUTE: … … 903 903 break; 904 904 } 905 if(prel->VirtualAddress + offset + fixupsize > virtAddress + size) 905 if(prel->VirtualAddress + offset + fixupsize > virtAddress + size) 906 906 { 907 907 //SvL: Restore original page protection flags … … 1308 1308 { //not found, so load it 1309 1309 char modname[CCHMAXPATH]; 1310 1310 1311 1311 strcpy(modname, pszCurModule); 1312 1312 //rename dll if necessary (i.e. OLE32 -> OLE32OS2) … … 1441 1441 NameExport *curexport; 1442 1442 ULONG ulAPIOrdinal; /* api requested by ordinal */ 1443 1443 1444 1444 apilen = strlen(name) + 1; 1445 if(apilen < 4) 1445 if(apilen < 4) 1446 1446 { 1447 1447 *(ULONG *)tmp = 0; … … 1452 1452 1453 1453 curexport = nameexports; 1454 for(i=0; i<nrNameExports; i++) 1454 for(i=0; i<nrNameExports; i++) 1455 1455 { 1456 if(apilen == curexport->nlength && 1457 *(ULONG *)curexport->name == *(ULONG *)name) 1456 if(apilen == curexport->nlength && 1457 *(ULONG *)curexport->name == *(ULONG *)name) 1458 1458 { 1459 if(strcmp(curexport->name, name) == 0) 1459 if(strcmp(curexport->name, name) == 0) 1460 1460 return(curexport->virtaddr); 1461 1461 } … … 1478 1478 curexport++; 1479 1479 } 1480 //Name exports also contain an ordinal, so check this 1480 //Name exports also contain an ordinal, so check this 1481 1481 nexport = nameexports; 1482 1482 for(i=0;i<nrNameExports;i++) {
Note:
See TracChangeset
for help on using the changeset viewer.