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.
stage-one/src/llodctor_pe.cpp

25 lines
930 B

#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;
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::section_t section{ section_name };
section.characteristics = sections[idx].characteristics.flags;
// copy the sections raw bytes...
section.section_raw.insert( section.section_raw.begin(), raw_img.data(),
raw_img.data() + sections[ idx ].ptr_raw_data );
iff.add_section( section );
}
if ( symbol_loader )
symbol_loader->load( iff );
}