Changeset 4110 for branches/GRACE/src/win32k/pe2lx/pe2lx.cpp
- Timestamp:
- Aug 29, 2000, 6:08:24 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GRACE/src/win32k/pe2lx/pe2lx.cpp
r4099 r4110 1 /* $Id: pe2lx.cpp,v 1.18.4. 9 2000-08-27 03:38:28bird Exp $1 /* $Id: pe2lx.cpp,v 1.18.4.10 2000-08-29 04:08:24 bird Exp $ 2 2 * 3 3 * Pe2Lx class implementation. Ring 0 and Ring 3 … … 481 481 dumpSectionHeader(&paSections[i]); 482 482 483 /* 8a. Convert characteristics to flags */483 /* 8a. Convert characteristics to flags and check/fix incompatible flags! */ 484 484 for (j = 0; j < (sizeof(paSecChars2Flags)/sizeof(paSecChars2Flags[0])); j++) 485 485 if ((paSections[i].Characteristics & paSecChars2Flags[j].Characteristics) == paSecChars2Flags[j].Characteristics) 486 486 flFlags |= paSecChars2Flags[j].flFlags; 487 if ((flFlags & (OBJEXEC | OBJWRITE)) == (OBJEXEC | OBJWRITE)) 488 flFlags &= (ULONG)~OBJEXEC; 487 489 488 490 /* 8b. Virtual/physical size */ … … 553 555 /* 11.Align section. (Fix which is applied to EXEs/Dlls which contain no fixups and has an 554 556 * alignment which is not a multiple of 64Kb. The sections are concatenated into one big object. */ 557 /* TODO! this test has to be enhanced a bit. WWPack32, new Borland++ depends on image layout. */ 555 558 fAllInOneObject = (pNtHdrs->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) == IMAGE_FILE_RELOCS_STRIPPED; 556 559 if (fAllInOneObject) … … 681 684 Yield(); 682 685 _res_heapmin(); 683 #if 0 /* testing */ 686 #ifndef RING0 687 #if 1 /* testing */ 684 688 testApplyFixups(); 689 #endif 685 690 #endif 686 691 … … 1101 1106 1102 1107 while ((unsigned)pbr - (unsigned)pBaseRelocs + 8 < cbBaseRelocs /* 8= VirtualAddress and SizeOfBlock members */ 1108 && pbr->SizeOfBlock >= 8 1103 1109 && pbr->VirtualAddress < ulRVAPage + PAGESIZE) 1104 1110 { … … 1585 1591 NOREF(pLdrLv); 1586 1592 NOREF(pful); 1593 NOREF(fOdin32PathValid); 1587 1594 return ERROR_NOT_SUPPORTED; 1588 1595 #endif … … 1622 1629 } 1623 1630 1624 rc = readAtRVA(0x00000000, &achPage[0], PAGESIZE); 1625 if (rc != NO_ERROR) 1626 { 1627 printErr(("readAtRVA failed with rc=%d\n")); 1628 return rc; 1629 } 1630 rc = applyFixups(&mte, 0, ~0UL, &achPage[0], 0x125D0000, NULL); 1631 1632 rc = readAtRVA(0x00001000, &achPage[0], PAGESIZE); 1633 if (rc != NO_ERROR) 1634 { 1635 printErr(("readAtRVA failed with rc=%d\n")); 1636 return rc; 1637 } 1638 rc = applyFixups(&mte, 1, 1, &achPage[0], 0x125E0000, NULL); 1631 /* 1632 * Test load and apply all (internal) fixups. 1633 */ 1634 for (i = 0; i < cObjects; i++) 1635 { 1636 ULONG ulAddress = smte.smte_objtab[i].ote_base; 1637 ULONG ulRVA = paObjects[i].ulRVA; 1638 LONG cbObject = paObjects[i].cbVirtual; 1639 for (i=i; cbObject > 0; cbObject -= PAGESIZE, ulAddress += PAGESIZE, ulRVA += PAGESIZE) 1640 { 1641 rc = readAtRVA(ulRVA, &achPage[0], PAGESIZE); 1642 if (rc != NO_ERROR) 1643 { 1644 printErr(("readAtRVA failed with rc=%d\n")); 1645 return rc; 1646 } 1647 rc = applyFixups(&mte, 1, 1, &achPage[0], ulAddress, NULL); 1648 if (rc != NO_ERROR) 1649 { 1650 printErr(("applyFixups failed with rc=%d\n")); 1651 return rc; 1652 } 1653 } 1654 } 1639 1655 1640 1656 return rc; … … 1690 1706 { 1691 1707 ULONG cbToRead = min(cbLXFile, sizeof(achReadBuffer)); 1692 rc = read(offLXFile, &achReadBuffer[0], cbToRead, 0UL, NULL);1708 rc = read(offLXFile, &achReadBuffer[0], 0UL, cbToRead, NULL); 1693 1709 if (rc != NO_ERROR) 1694 1710 { … … 3108 3124 { 3109 3125 PIMAGE_BASE_RELOCATION pbrCur = pBaseRelocs; 3110 while ((void*)pbrCur < (void*)((unsigned)pBaseRelocs + cbBaseRelocs)) 3126 while ((void*)pbrCur < (void*)((unsigned)pBaseRelocs + cbBaseRelocs) 3127 && pbrCur->SizeOfBlock >= 8) 3111 3128 { 3112 3129 if ((unsigned)pbrCur->SizeOfBlock + (unsigned)pbrCur > (unsigned)pBaseRelocs + cbBaseRelocs)
Note:
See TracChangeset
for help on using the changeset viewer.