updated PE bin info to handle RDI entry, changed raddump to

convert and load RDI from memory, added helper for parsing debug directory
This commit is contained in:
Nikita Smith
2025-01-14 16:49:05 -08:00
parent b1c5b308c0
commit b889765c15
3 changed files with 321 additions and 275 deletions
+42 -5
View File
@@ -1003,17 +1003,53 @@ struct PE_BinInfo
U64 symbol_array_off;
U64 symbol_count;
U64 string_table_off;
U64 dbg_path_off;
U64 dbg_path_size;
Guid dbg_guid;
U32 dbg_age;
U32 dbg_time;
Arch arch;
Rng1U64 *data_dir_franges;
U32 data_dir_count;
PE_TLSHeader64 tls_header;
};
typedef struct PE_DebugInfo
{
PE_DebugDirectory header;
union
{
union
{
U32 magic;
struct
{
PE_CvHeaderPDB20 header;
String8 path;
} pdb20;
struct
{
PE_CvHeaderPDB70 header;
String8 path;
} pdb70;
struct
{
PE_CvHeaderRDI header;
String8 path;
} rdi;
} codeview;
String8 raw_data;
} u;
} PE_DebugInfo;
typedef struct PE_DebugInfoNode
{
struct PE_DebugInfoNode *next;
PE_DebugInfo v;
} PE_DebugInfoNode;
typedef struct PE_DebugInfoList
{
PE_DebugInfoNode *first;
PE_DebugInfoNode *last;
U64 count;
} PE_DebugInfoList;
////////////////////////////////
//~ rjf: Basic Enum Functions
@@ -1038,6 +1074,7 @@ internal String8 pe_string_from_dll_characteristics(Arena *arena, PE_DllCharacte
internal PE_BinInfo pe_bin_info_from_data(Arena *arena, String8 data);
internal PE_DebugInfoList pe_parse_debug_directory(Arena *arena, String8 raw_image, String8 raw_debug_dir);
internal PE_ParsedStaticImportTable pe_static_imports_from_data(Arena *arena, B32 is_pe32, U64 section_count, COFF_SectionHeader *sections, String8 raw_data, Rng1U64 dir_file_range);
internal PE_ParsedDelayImportTable pe_delay_imports_from_data(Arena *arena, B32 is_pe32, U64 section_count, COFF_SectionHeader *sections, String8 raw_data, Rng1U64 dir_file_range);
internal PE_ParsedExportTable pe_exports_from_data(Arena *arena, U64 section_count, COFF_SectionHeader *sections, String8 raw_data, Rng1U64 dir_file_range, Rng1U64 dir_virt_range);