Blame src/internal/perk/perk_structs.h

7a4920
#ifndef PERK_STRUCTS_H
7a4920
#define PERK_STRUCTS_H
7a4920
7a4920
#ifdef __cplusplus
7a4920
extern "C" {
7a4920
#endif
7a4920
7a4920
struct pe_raw_image_dos_hdr {
7a4920
	unsigned char	dos_magic			[0x02];		/* 0x00 */
7a4920
	unsigned char	dos_cblp			[0x02];		/* 0x02 */
7a4920
	unsigned char	dos_cp				[0x02];		/* 0x04 */
7a4920
	unsigned char	dos_crlc			[0x02];		/* 0x06 */
7a4920
	unsigned char	dos_cparhdr			[0x02];		/* 0x08 */
7a4920
	unsigned char	dos_minalloc			[0x02];		/* 0x0a */
7a4920
	unsigned char	dos_maxalloc			[0x02];		/* 0x0c */
7a4920
	unsigned char	dos_ss				[0x02];		/* 0x0e */
7a4920
	unsigned char	dos_sp				[0x02];		/* 0x10 */
7a4920
	unsigned char	dos_csum			[0x02];		/* 0x12 */
7a4920
	unsigned char	dos_ip				[0x02];		/* 0x14 */
7a4920
	unsigned char	dos_cs				[0x02];		/* 0x16 */
7a4920
	unsigned char	dos_lfarlc			[0x02];		/* 0x18 */
7a4920
	unsigned char	dos_ovno			[0x02];		/* 0x1a */
7a4920
	unsigned char	dos_res				[0x08];		/* 0x1c */
7a4920
	unsigned char	dos_oemid			[0x02];		/* 0x24 */
7a4920
	unsigned char	dos_oeminfo			[0x02];		/* 0x26 */
7a4920
	unsigned char	dos_res2			[0x14];		/* 0x28 */
7a4920
	unsigned char	dos_lfanew			[0x04];		/* 0x3c */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_coff_image_hdr {
7a4920
	unsigned char	cfh_signature			[0x04];		/* 0x00 */
7a4920
	unsigned char	cfh_machine			[0x02];		/* 0x04 */
7a4920
	unsigned char	cfh_num_of_sections		[0x02];		/* 0x06 */
7a4920
	unsigned char	cfh_time_date_stamp		[0x04];		/* 0x08 */
7a4920
	unsigned char	cfh_ptr_to_sym_tbl		[0x04];		/* 0x0c */
7a4920
	unsigned char	cfh_num_of_syms			[0x04];		/* 0x10 */
7a4920
	unsigned char	cfh_size_of_opt_hdr		[0x02];		/* 0x14 */
7a4920
	unsigned char	cfh_characteristics		[0x02];		/* 0x16 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_coff_object_hdr {
7a4920
	unsigned char	cfh_machine			[0x02];		/* 0x00 */
7a4920
	unsigned char	cfh_num_of_sections		[0x02];		/* 0x02 */
7a4920
	unsigned char	cfh_time_date_stamp		[0x04];		/* 0x04 */
7a4920
	unsigned char	cfh_ptr_to_sym_tbl		[0x04];		/* 0x08 */
7a4920
	unsigned char	cfh_num_of_syms			[0x04];		/* 0x0c */
7a4920
	unsigned char	cfh_size_of_opt_hdr		[0x02];		/* 0x10 */
7a4920
	unsigned char	cfh_characteristics		[0x02];		/* 0x12 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_opt_hdr_std {
7a4920
	unsigned char	coh_magic			[0x02];		/* 0x00 */
7a4920
	unsigned char	coh_major_linker_ver		[0x01];		/* 0x02 */
7a4920
	unsigned char	coh_minor_linker_ver		[0x01];		/* 0x03 */
7a4920
	unsigned char	coh_size_of_code		[0x04];		/* 0x04 */
7a4920
	unsigned char	coh_size_of_inited_data		[0x04];		/* 0x08 */
7a4920
	unsigned char	coh_size_of_uninited_data	[0x04];		/* 0x0c */
7a4920
	unsigned char	coh_entry_point			[0x04];		/* 0x10 */
7a4920
	unsigned char	coh_base_of_code		[0x04];		/* 0x14 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_opt_hdr_align {
7a4920
	unsigned char	coh_section_align		[0x04];		/* 0x20 */
7a4920
	unsigned char	coh_file_align			[0x04];         /* 0x24 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_opt_hdr_vers {
7a4920
	unsigned char	coh_major_os_ver		[0x02];		/* 0x28 */
7a4920
	unsigned char	coh_minor_os_ver		[0x02];		/* 0x2a */
7a4920
	unsigned char	coh_major_image_ver		[0x02];		/* 0x2c */
7a4920
	unsigned char	coh_minor_image_ver		[0x02];		/* 0x2e */
7a4920
	unsigned char	coh_major_subsys_ver		[0x02];		/* 0x30 */
7a4920
	unsigned char	coh_minor_subsys_ver		[0x02];		/* 0x32 */
7a4920
	unsigned char	coh_win32_ver			[0x04];		/* 0x34 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_opt_hdr_img {
7a4920
	unsigned char	coh_size_of_image		[0x04];		/* 0x38 */
7a4920
	unsigned char	coh_size_of_headers		[0x04];		/* 0x3c */
7a4920
	unsigned char	coh_checksum			[0x04];		/* 0x40 */
7a4920
	unsigned char	coh_subsystem			[0x02];		/* 0x44 */
7a4920
	unsigned char	coh_dll_characteristics		[0x02];		/* 0x46 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_opt_hdr_ldr {
7a4920
	unsigned char	coh_loader_flags		[0x04];
7a4920
	unsigned char	coh_rva_and_sizes		[0x04];
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_opt_hdr_dirs {
7a4920
	unsigned char	coh_export_tbl			[0x08];
7a4920
	unsigned char	coh_import_tbl			[0x08];
7a4920
	unsigned char	coh_resource_tbl		[0x08];
7a4920
	unsigned char	coh_exception_tbl		[0x08];
7a4920
	unsigned char	coh_certificate_tbl		[0x08];
7a4920
	unsigned char	coh_base_reloc_tbl		[0x08];
7a4920
	unsigned char	coh_debug			[0x08];
7a4920
	unsigned char	coh_arch			[0x08];
7a4920
	unsigned char	coh_global_ptr			[0x08];
7a4920
	unsigned char	coh_tls_tbl			[0x08];
7a4920
	unsigned char	coh_load_config_tbl		[0x08];
7a4920
	unsigned char	coh_bound_import		[0x08];
7a4920
	unsigned char	coh_iat				[0x08];
7a4920
	unsigned char	coh_delay_import_descriptor	[0x08];
7a4920
	unsigned char	coh_clr_runtime_hdr		[0x08];
7a4920
	unsigned char	coh_reserved			[0x08];
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_data_dirs {
7a4920
	unsigned char	coh_rva_and_sizes		[0x04];
7a4920
	unsigned char	coh_export_tbl			[0x08];
7a4920
	unsigned char	coh_import_tbl			[0x08];
7a4920
	unsigned char	coh_resource_tbl		[0x08];
7a4920
	unsigned char	coh_exception_tbl		[0x08];
7a4920
	unsigned char	coh_certificate_tbl		[0x08];
7a4920
	unsigned char	coh_base_reloc_tbl		[0x08];
7a4920
	unsigned char	coh_debug			[0x08];
7a4920
	unsigned char	coh_arch			[0x08];
7a4920
	unsigned char	coh_global_ptr			[0x08];
7a4920
	unsigned char	coh_tls_tbl			[0x08];
7a4920
	unsigned char	coh_load_config_tbl		[0x08];
7a4920
	unsigned char	coh_bound_import		[0x08];
7a4920
	unsigned char	coh_iat				[0x08];
7a4920
	unsigned char	coh_delay_import_descriptor	[0x08];
7a4920
	unsigned char	coh_clr_runtime_hdr		[0x08];
7a4920
	unsigned char	coh_reserved			[0x08];
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_opt_hdr_32 {
7a4920
	unsigned char	coh_magic			[0x02];		/* 0x00 */
7a4920
	unsigned char	coh_major_linker_ver		[0x01];		/* 0x02 */
7a4920
	unsigned char	coh_minor_linker_ver		[0x01];		/* 0x03 */
7a4920
	unsigned char	coh_size_of_code		[0x04];		/* 0x04 */
7a4920
	unsigned char	coh_size_of_inited_data		[0x04];		/* 0x08 */
7a4920
	unsigned char	coh_size_of_uninited_data	[0x04];		/* 0x0c */
7a4920
	unsigned char	coh_entry_point			[0x04];		/* 0x10 */
7a4920
	unsigned char	coh_base_of_code		[0x04];		/* 0x14 */
7a4920
	unsigned char	coh_base_of_data		[0x04];		/* 0x18 */
7a4920
	unsigned char	coh_image_base			[0x04];		/* 0x1c */
7a4920
	unsigned char	coh_section_align		[0x04];		/* 0x20 */
7a4920
	unsigned char	coh_file_align			[0x04];         /* 0x24 */
7a4920
	unsigned char	coh_major_os_ver		[0x02];		/* 0x28 */
7a4920
	unsigned char	coh_minor_os_ver		[0x02];		/* 0x2a */
7a4920
	unsigned char	coh_major_image_ver		[0x02];		/* 0x2c */
7a4920
	unsigned char	coh_minor_image_ver		[0x02];		/* 0x2e */
7a4920
	unsigned char	coh_major_subsys_ver		[0x02];		/* 0x30 */
7a4920
	unsigned char	coh_minor_subsys_ver		[0x02];		/* 0x32 */
7a4920
	unsigned char	coh_win32_ver			[0x04];		/* 0x34 */
7a4920
	unsigned char	coh_size_of_image		[0x04];		/* 0x38 */
7a4920
	unsigned char	coh_size_of_headers		[0x04];		/* 0x3c */
7a4920
	unsigned char	coh_checksum			[0x04];		/* 0x40 */
7a4920
	unsigned char	coh_subsystem			[0x02];		/* 0x44 */
7a4920
	unsigned char	coh_dll_characteristics		[0x02];		/* 0x46 */
7a4920
	unsigned char	coh_size_of_stack_reserve	[0x04];		/* 0x48 */
7a4920
	unsigned char	coh_size_of_stack_commit	[0x04];		/* 0x4c */
7a4920
	unsigned char	coh_size_of_heap_reserve	[0x04];		/* 0x50 */
7a4920
	unsigned char	coh_size_of_heap_commit		[0x04];		/* 0x54 */
7a4920
	unsigned char	coh_loader_flags		[0x04];		/* 0x58 */
7a4920
	unsigned char	coh_rva_and_sizes		[0x04];		/* 0x5c */
7a4920
	unsigned char	coh_export_tbl			[0x08];		/* 0x60 */
7a4920
	unsigned char	coh_import_tbl			[0x08];		/* 0x68 */
7a4920
	unsigned char	coh_resource_tbl		[0x08];		/* 0x70 */
7a4920
	unsigned char	coh_exception_tbl		[0x08];		/* 0x78 */
7a4920
	unsigned char	coh_certificate_tbl		[0x08];		/* 0x80 */
7a4920
	unsigned char	coh_base_reloc_tbl		[0x08];		/* 0x88 */
7a4920
	unsigned char	coh_debug			[0x08];		/* 0x90 */
7a4920
	unsigned char	coh_arch			[0x08];		/* 0x98 */
7a4920
	unsigned char	coh_global_ptr			[0x08];		/* 0xa0 */
7a4920
	unsigned char	coh_tls_tbl			[0x08];		/* 0xa8 */
7a4920
	unsigned char	coh_load_config_tbl		[0x08];		/* 0xb0 */
7a4920
	unsigned char	coh_bound_import		[0x08];		/* 0xb8 */
7a4920
	unsigned char	coh_iat				[0x08];		/* 0xc0 */
7a4920
	unsigned char	coh_delay_import_descriptor	[0x08];		/* 0xc8 */
7a4920
	unsigned char	coh_clr_runtime_hdr		[0x08];		/* 0xd0 */
7a4920
	unsigned char	coh_reserved			[0x08];		/* 0xd8 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_opt_hdr_64 {
7a4920
	unsigned char	coh_magic			[0x02];		/* 0x00 */
7a4920
	unsigned char	coh_major_linker_ver		[0x01];		/* 0x02 */
7a4920
	unsigned char	coh_minor_linker_ver		[0x01];		/* 0x03 */
7a4920
	unsigned char	coh_size_of_code		[0x04];		/* 0x04 */
7a4920
	unsigned char	coh_size_of_inited_data		[0x04];		/* 0x08 */
7a4920
	unsigned char	coh_size_of_uninited_data	[0x04];		/* 0x0c */
7a4920
	unsigned char	coh_entry_point			[0x04];		/* 0x10 */
7a4920
	unsigned char	coh_base_of_code		[0x04];		/* 0x14 */
7a4920
	unsigned char	coh_image_base			[0x08];		/* 0x18 */
7a4920
	unsigned char	coh_section_align		[0x04];		/* 0x20 */
7a4920
	unsigned char	coh_file_align			[0x04];         /* 0x24 */
7a4920
	unsigned char	coh_major_os_ver		[0x02];		/* 0x28 */
7a4920
	unsigned char	coh_minor_os_ver		[0x02];		/* 0x2a */
7a4920
	unsigned char	coh_major_image_ver		[0x02];		/* 0x2c */
7a4920
	unsigned char	coh_minor_image_ver		[0x02];		/* 0x2e */
7a4920
	unsigned char	coh_major_subsys_ver		[0x02];		/* 0x30 */
7a4920
	unsigned char	coh_minor_subsys_ver		[0x02];		/* 0x32 */
7a4920
	unsigned char	coh_win32_ver			[0x04];		/* 0x34 */
7a4920
	unsigned char	coh_size_of_image		[0x04];		/* 0x38 */
7a4920
	unsigned char	coh_size_of_headers		[0x04];		/* 0x3c */
7a4920
	unsigned char	coh_checksum			[0x04];		/* 0x40 */
7a4920
	unsigned char	coh_subsystem			[0x02];		/* 0x44 */
7a4920
	unsigned char	coh_dll_characteristics		[0x02];		/* 0x46 */
7a4920
	unsigned char	coh_size_of_stack_reserve	[0x08];		/* 0x48 */
7a4920
	unsigned char	coh_size_of_stack_commit	[0x08];		/* 0x50 */
7a4920
	unsigned char	coh_size_of_heap_reserve	[0x08];		/* 0x58 */
7a4920
	unsigned char	coh_size_of_heap_commit		[0x08];		/* 0x60 */
7a4920
	unsigned char	coh_loader_flags		[0x04];		/* 0x68 */
7a4920
	unsigned char	coh_rva_and_sizes		[0x04];		/* 0x6c */
7a4920
	unsigned char	coh_export_tbl			[0x08];		/* 0x70 */
7a4920
	unsigned char	coh_import_tbl			[0x08];		/* 0x78 */
7a4920
	unsigned char	coh_resource_tbl		[0x08];		/* 0x80 */
7a4920
	unsigned char	coh_exception_tbl		[0x08];		/* 0x88 */
7a4920
	unsigned char	coh_certificate_tbl		[0x08];		/* 0x90 */
7a4920
	unsigned char	coh_base_reloc_tbl		[0x08];		/* 0x98 */
7a4920
	unsigned char	coh_debug			[0x08];		/* 0xa0 */
7a4920
	unsigned char	coh_arch			[0x08];		/* 0xa8 */
7a4920
	unsigned char	coh_global_ptr			[0x08];		/* 0xb0 */
7a4920
	unsigned char	coh_tls_tbl			[0x08];		/* 0xb8 */
7a4920
	unsigned char	coh_load_config_tbl		[0x08];		/* 0xc0 */
7a4920
	unsigned char	coh_bound_import		[0x08];		/* 0xc8 */
7a4920
	unsigned char	coh_iat				[0x08];		/* 0xd0 */
7a4920
	unsigned char	coh_delay_import_descriptor	[0x08];		/* 0xd8 */
7a4920
	unsigned char	coh_clr_runtime_hdr		[0x08];		/* 0xe0 */
7a4920
	unsigned char	coh_reserved			[0x08];		/* 0xe8 */
7a4920
};
7a4920
7a4920
7a4920
union pe_raw_opt_hdr {
7a4920
	struct pe_raw_opt_hdr_32    opt_hdr_32;
7a4920
	struct pe_raw_opt_hdr_64    opt_hdr_64;
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_image_data_dir {
7a4920
	unsigned char	dh_rva				[0x04];		/* 0x00 */
7a4920
	unsigned char	dh_size				[0x04];		/* 0x04 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_sec_hdr {
7a4920
	unsigned char	sh_name				[0x08];		/* 0x00 */
7a4920
	unsigned char	sh_virtual_size			[0x04];		/* 0x08 */
7a4920
	unsigned char	sh_virtual_addr			[0x04];		/* 0x0c */
7a4920
	unsigned char	sh_size_of_raw_data		[0x04];		/* 0x10 */
7a4920
	unsigned char	sh_ptr_to_raw_data		[0x04];		/* 0x14 */
7a4920
	unsigned char	sh_ptr_to_relocs		[0x04];		/* 0x18 */
7a4920
	unsigned char	sh_ptr_to_line_nums		[0x04];		/* 0x1c */
7a4920
	unsigned char	sh_num_of_relocs		[0x02];		/* 0x20 */
7a4920
	unsigned char	sh_num_of_line_nums		[0x02];		/* 0x22 */
7a4920
	unsigned char	sh_characteristics		[0x04];		/* 0x24 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_export_hdr {
7a4920
	unsigned char	eh_export_flags			[0x04];		/* 0x00 */
7a4920
	unsigned char	eh_time_date_stamp		[0x04];		/* 0x04 */
7a4920
	unsigned char	eh_major_ver			[0x02];		/* 0x08 */
7a4920
	unsigned char	eh_minor_ver			[0x02];		/* 0x0a */
7a4920
	unsigned char	eh_name_rva			[0x04];		/* 0x0c */
7a4920
	unsigned char	eh_ordinal_base			[0x04];		/* 0x10 */
7a4920
	unsigned char	eh_addr_tbl_entries		[0x04];		/* 0x14 */
7a4920
	unsigned char	eh_num_of_name_ptrs		[0x04];		/* 0x18 */
7a4920
	unsigned char	eh_export_addr_tbl_rva		[0x04];		/* 0x1c */
7a4920
	unsigned char	eh_name_ptr_rva			[0x04];		/* 0x20 */
7a4920
	unsigned char	eh_ordinal_tbl_rva		[0x04];		/* 0x24 */
7a4920
};
7a4920
7a4920
7a4920
union pe_raw_export_addr_tbl {
7a4920
	unsigned char	  ee_export_rva			[0x04];		/* 0x00 */
7a4920
	unsigned char	  ee_forwarder_rva		[0x04];		/* 0x00 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_import_hdr {
7a4920
	unsigned char	ih_import_lookup_tbl_rva	[0x04];		/* 0x00 */
7a4920
	unsigned char	ih_time_date_stamp		[0x04];		/* 0x04 */
7a4920
	unsigned char	ih_forwarder_chain		[0x04];		/* 0x08 */
7a4920
	unsigned char	ih_name_rva			[0x04];		/* 0x0c */
7a4920
	unsigned char	ih_import_addr_tbl_rva		[0x04];		/* 0x10 */
7a4920
};
7a4920
7a4920
7a4920
union pe_raw_import_lookup {
7a4920
	unsigned char	ii_import_lookup_entry_64	[0x08];		/* 0x00 */
7a4920
	unsigned char	ii_import_lookup_entry_32	[0x04];		/* 0x00 */
7a4920
	unsigned char	ii_hint_name_tbl_rva		[0x04];		/* 0x00 */
7a4920
	unsigned char	ii_ordinal_number		[0x02];		/* 0x00 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_hint_name_entry {
7a4920
	unsigned char	ii_hint				[0x02];		/* 0x00 */
7a4920
	unsigned char	ii_name				[0x02];		/* 0x02 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_coff_symbol {
7a4920
	unsigned char	cs_name				[0x08];		/* 0x00 */
7a4920
	unsigned char	cs_value			[0x04];		/* 0x08 */
7a4920
	unsigned char	cs_section_number		[0x02];		/* 0x0c */
7a4920
	unsigned char	cs_type				[0x02];		/* 0x0e */
7a4920
	unsigned char	cs_storage_class		[0x01];		/* 0x10 */
7a4920
	unsigned char	cs_num_of_aux_symbols		[0x01];		/* 0x11 */
7a4920
};
7a4920
7a4920
7a4920
struct pe_raw_coff_symbol_name {
7a4920
	union {
7a4920
		unsigned char		cs_short_name	[0x08];		/* 0x00 */
7a4920
7a4920
		struct {
7a4920
			unsigned char	cs_zeroes	[0x04];		/* 0x00 */
7a4920
			unsigned char	cs_offset	[0x04];		/* 0x04 */
7a4920
		} long_name;
7a4920
	};
7a4920
};
7a4920
7a4920
24bd6a
struct pe_raw_coff_strtbl {
24bd6a
	unsigned char	cst_size			[0x04];		/* 0x00 */
24bd6a
	unsigned char	cst_data[];					/* 0x04 */
24bd6a
};
24bd6a
24bd6a
24bd6a
struct pe_raw_coff_reloc {
24bd6a
	unsigned char	rel_rva				[0x04];		/* 0x00 */
24bd6a
	unsigned char	rel_sym				[0x04];		/* 0x04 */
24bd6a
	unsigned char	rel_type			[0x02];		/* 0x08 */
24bd6a
};
24bd6a
24bd6a
bbf7fc
struct pe_raw_aux_rec_section {
24bd6a
	unsigned char	aux_size			[0x04];		/* 0x00 */
24bd6a
	unsigned char	aux_num_of_relocs		[0x02];		/* 0x04 */
24bd6a
	unsigned char	aux_num_of_line_nums		[0x02];		/* 0x06 */
24bd6a
	unsigned char	aux_check_sum			[0x04];		/* 0x08 */
24bd6a
	unsigned char	aux_number			[0x02];		/* 0x0c */
24bd6a
	unsigned char	aux_selection			[0x01];		/* 0x0e */
24bd6a
	unsigned char	aux_pad				[0x03];		/* 0x0f */
24bd6a
};
24bd6a
5d3a93
struct pe_raw_archive_common_hdr {
5d3a93
	unsigned char	ar_file_id			[0x10];		/* 0x00 */
5d3a93
	unsigned char	ar_time_date_stamp		[0x0c];		/* 0x10 */
5d3a93
	unsigned char	ar_uid				[0x06];		/* 0x1c */
5d3a93
	unsigned char	ar_gid				[0x06];		/* 0x22 */
5d3a93
	unsigned char	ar_file_mode			[0x08];		/* 0x28 */
5d3a93
	unsigned char	ar_file_size			[0x0a];		/* 0x30 */
5d3a93
	unsigned char	ar_end_tag			[0x02];		/* 0x3a */
5d3a93
5d3a93
};
5d3a93
7a4920
#ifdef __cplusplus
7a4920
}
7a4920
#endif
7a4920
7a4920
#endif