Merge pull request #2 from gmh5225/dev

Support /FIXED
master
mike1k 3 years ago committed by GitHub
commit e8687c86f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,11 +37,14 @@ X86BA_TEMPLATE void X86BinaryApplication<BitSize>::loadFromFile(std::string_view
_originalRelocs.clear();
if (_peFile.getRelocDir().isPresent())
{
_peFile.getRelocDir().forEachEntry(
[this](pe::BlockEntry const& entry)
{
_originalRelocs.insert(entry.getRva());
});
}
// printf("* - Number of relocations: 0x%x\n", _originalRelocs.size());
}
@ -714,7 +717,10 @@ X86BA_TEMPLATE bool X86BinaryApplication<BitSize>::transformRoutines()
}
// Guesstimate.. Fix this..
if (_peFile.getRelocDir().isPresent())
{
_peFile.getRelocDir().extend(((_routines.size() + 0x3) & ~0x3) * 0x100);
}
for (auto& rtn : _routines)
{
@ -856,10 +862,12 @@ X86BA_TEMPLATE void X86BinaryApplication<BitSize>::compile()
//
// Append all relocations
if (_peFile.getRelocDir().isPresent())
{
for (auto it = _relocBlocks.begin(); it != _relocBlocks.end(); ++it)
{
u32 rva = it->first;
std::vector<RelocationEntry> const &entries = it->second;
std::vector<RelocationEntry> const& entries = it->second;
if (entries.empty())
continue;
@ -888,6 +896,7 @@ X86BA_TEMPLATE void X86BinaryApplication<BitSize>::compile()
bs.append(pe::RelocationType::REL_BASED_ABSOLUTE, 0);
}
}
}
pe::SectionHeader& reloc = _peFile.getSectionHdr(".reloc");
std::uint32_t fileAlignment = _peFile.getPEHdr().getOptionalHdr().getFileAlignment();

Loading…
Cancel
Save