WIP
This commit is contained in:
parent
b1dc3a13c2
commit
b19de8b1b7
|
@ -81,6 +81,19 @@ int main(int argc, char *argv[]) {
|
|||
spdlog::info("Found main function at offset {} with size {}", mainOffset,
|
||||
mainSize);
|
||||
|
||||
// List relocations for the main function section
|
||||
auto& sectionRelocations = mainSection->get_relocations();
|
||||
spdlog::info("Relocations for section {} (containing main function):", mainSymbol->get_section_number());
|
||||
for (auto& reloc : sectionRelocations) {
|
||||
spdlog::info(" Relocation at offset 0x{:x}, type: {}, symbol index: {}",
|
||||
reloc.get_virtual_address(),
|
||||
reloc.get_type(),
|
||||
reloc.get_symbol_table_index());
|
||||
|
||||
// Get symbol name for this relocation
|
||||
spdlog::info(" -> Symbol: {}", reloc.get_symbol());
|
||||
}
|
||||
|
||||
spdlog::info("Main function code:");
|
||||
std::string s;
|
||||
for (uint32_t i = 0; i < mainSize; i++) {
|
||||
|
@ -110,10 +123,21 @@ int main(int argc, char *argv[]) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
uint32_t textSectionEnd =
|
||||
textSection->get_virtual_address() + textSection->get_virtual_size();
|
||||
spdlog::info("Found .text section, end at virtual address: 0x{:x}",
|
||||
textSectionEnd);
|
||||
// Get image base and calculate actual VA
|
||||
uint64_t imageBase = 0;
|
||||
auto winHeader = peReader.get_win_header();
|
||||
if (winHeader) {
|
||||
imageBase = winHeader->get_image_base();
|
||||
}
|
||||
|
||||
uint32_t textSectionRVA = textSection->get_virtual_address();
|
||||
uint32_t textSectionSize = textSection->get_virtual_size();
|
||||
uint64_t textSectionVA = imageBase + textSectionRVA;
|
||||
uint64_t textSectionEndVA = textSectionVA + textSectionSize;
|
||||
|
||||
spdlog::info("PE Image base: 0x{:x}", imageBase);
|
||||
spdlog::info(".text section RVA: 0x{:x}, size: 0x{:x}", textSectionRVA, textSectionSize);
|
||||
spdlog::info(".text section VA: 0x{:x} - 0x{:x}", textSectionVA, textSectionEndVA);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue