pass over COFF resource reader and writer

This commit is contained in:
Nikita Smith
2024-10-19 13:44:36 -07:00
parent 46390ba0b8
commit 800a2349e5
8 changed files with 347 additions and 367 deletions
+15
View File
@@ -901,6 +901,21 @@ pe_resource_table_from_directory_data(Arena *arena, String8 data)
return bottom_frame->table;
}
internal String8
pe_make_manifest_resource(Arena *arena, U32 resource_id, String8 manifest_data)
{
COFF_ResourceID type = {0};
type.type = COFF_ResourceIDType_NUMBER;
type.u.number = PE_ResourceKind_MANIFEST;
COFF_ResourceID id = {0};
id.type = COFF_ResourceIDType_NUMBER;
id.u.number = resource_id;
String8 res = coff_write_resource(arena, type, id, 1, 0, 1033, 0, 0, manifest_data);
return res;
}
////////////////////////////////
//~ Debug Directory
+2 -2
View File
@@ -452,8 +452,6 @@ struct PE_TLSHeader64
U32 characteristics; // COFF_SectionFlags but only align flags are used.
};
#define PE_RES_ALIGN 4u
global read_only U8 PE_RES_MAGIC[] =
{
0x00, 0x00, 0x00, 0x00,
@@ -781,6 +779,8 @@ internal PE_Resource * pe_resource_dir_search(PE_ResourceDir *dir, COFF_Reso
internal PE_ResourceArray pe_resource_list_to_array(Arena *arena, PE_ResourceList *list);
internal PE_ResourceDir * pe_resource_table_from_directory_data(Arena *arena, String8 data);
internal String8 pe_make_manifest_resource(Arena *arena, U32 resource_id, String8 manifest_data);
////////////////////////////////
//~ Debug Directory