lifted pe sections to iff... still needs to be mulled over...

_xeroxz
_xeroxz 3 years ago
parent d559b996ed
commit ac06163926

@ -12,22 +12,23 @@ namespace llo
class lloiff_t
{
public:
explicit lloiff_t( std::string &&file_name ) : file_name( file_name )
{
}
lloiff_t( std::string &file_name ) : file_name( file_name )
{
}
class section_t
{
public:
llo::utils::hash_t< std::string > section_name;
std::uint64_t characteristics;
std::vector< std::shared_ptr< llo::symbol::symbol_base_t > > symbols;
std::vector< std::uint8_t > section_raw;
};
explicit lloiff_t( std::string &&file_name ) : file_name( file_name )
{
}
lloiff_t( std::string &file_name ) : file_name( file_name )
{
}
llo::utils::hash_t< std::string > get_name() const
{
return file_name;
@ -43,6 +44,11 @@ namespace llo
sections.push_back( section );
}
void add_section( section_t &section )
{
sections.push_back( section );
}
private:
llo::utils::hash_t< std::string > file_name;
std::vector< section_t > sections;

@ -6,9 +6,17 @@ void llo::s1::dctor_pe_t::generate( lloiff_t &iff )
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, ++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 )

@ -82,5 +82,13 @@ int __cdecl main( int argc, const char *argv[] )
llo::lloiff_t iff( file_name );
file_dctor->generate( iff );
std::printf( "> number of sections = %d\n", iff.get_sections().size() );
const auto &sections = iff.get_sections();
std::printf( "> number of sections = %d\n", sections.size() );
for ( auto &section : sections )
{
std::printf( "> section name = %s\n", section.section_name.get_data().c_str() );
std::printf( "> size of raw section = %d\n", section.section_raw.size() );
std::printf( "> number of symbols = %d\n", section.symbols.size() );
}
}
Loading…
Cancel
Save