You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.5 KiB
35 lines
1.5 KiB
#include <llodctor/llodctor_pe.hpp>
|
|
|
|
void llo::s1::dctor_pe_t::generate( lloiff_t &iff )
|
|
{
|
|
auto dos_header = reinterpret_cast< win::dos_header_t * >( raw_img.data() );
|
|
auto sections = dos_header->get_nt_headers()->get_sections();
|
|
auto section_count = dos_header->get_nt_headers()->file_header.num_sections;
|
|
auto entry_point = dos_header->get_nt_headers()->optional_header.entry_point;
|
|
|
|
// lift section information to iff...
|
|
for ( auto idx = 0u; idx < section_count; ++idx )
|
|
{
|
|
llo::utils::hash_t< std::string > section_name{ std::string( sections[ idx ].name.to_string() ) };
|
|
llo::lloiff_t::iff_section_t section{ section_name };
|
|
section.characteristics = sections[ idx ].characteristics.flags;
|
|
|
|
// check to see if this section contains the entry point of the module...
|
|
if ( entry_point >= sections[ idx ].virtual_address &&
|
|
entry_point < sections[ idx ].virtual_address + sections[ idx ].virtual_size )
|
|
{
|
|
// lift entry point to iff...
|
|
iff.entry =
|
|
llo::disposition_t::make( iff.name, section_name, ( entry_point - sections[ idx ].virtual_address ) );
|
|
}
|
|
|
|
// copy the sections raw bytes...
|
|
section.raw.insert( section.raw.begin(), raw_img.data(), raw_img.data() + sections[ idx ].ptr_raw_data );
|
|
iff.sections.push_back( section );
|
|
}
|
|
|
|
// run symbol loader pass... this could be pdb, map, etc...
|
|
if ( symbol_loader )
|
|
symbol_loader->load( iff );
|
|
}
|