Blame include/pemagine/pe_structs.h

feffc7
#ifndef PE_STRUCTS_H
feffc7
#define PE_STRUCTS_H
feffc7
feffc7
#ifdef __cplusplus
feffc7
extern "C" {
feffc7
#endif
feffc7
de5b30
struct pe_raw_image_dos_hdr {
bdd8c8
	unsigned char	dos_magic			[0x02];		/* 0x00 */
bdd8c8
	unsigned char	dos_cblp			[0x02];		/* 0x02 */
bdd8c8
	unsigned char	dos_cp				[0x02];		/* 0x04 */
bdd8c8
	unsigned char	dos_crlc			[0x02];		/* 0x06 */
bdd8c8
	unsigned char	dos_cparhdr			[0x02];		/* 0x08 */
bdd8c8
	unsigned char	dos_minalloc			[0x02];		/* 0x0a */
bdd8c8
	unsigned char	dos_maxalloc			[0x02];		/* 0x0c */
bdd8c8
	unsigned char	dos_ss				[0x02];		/* 0x0e */
bdd8c8
	unsigned char	dos_sp				[0x02];		/* 0x10 */
bdd8c8
	unsigned char	dos_csum			[0x02];		/* 0x12 */
bdd8c8
	unsigned char	dos_ip				[0x02];		/* 0x14 */
bdd8c8
	unsigned char	dos_cs				[0x02];		/* 0x16 */
bdd8c8
	unsigned char	dos_lfarlc			[0x02];		/* 0x18 */
bdd8c8
	unsigned char	dos_ovno			[0x02];		/* 0x1a */
bdd8c8
	unsigned char	dos_res				[0x08];		/* 0x1c */
bdd8c8
	unsigned char	dos_oemid			[0x02];		/* 0x24 */
bdd8c8
	unsigned char	dos_oeminfo			[0x02];		/* 0x26 */
bdd8c8
	unsigned char	dos_res2			[0x14];		/* 0x28 */
bdd8c8
	unsigned char	dos_lfanew			[0x04];		/* 0x3c */
feffc7
};
feffc7
feffc7
945985
struct pe_raw_coff_file_hdr {
bdd8c8
	unsigned char	signature			[0x04];		/* 0x00 */
bdd8c8
	unsigned char	machine				[0x02];		/* 0x04 */
bdd8c8
	unsigned char	num_of_sections			[0x02];		/* 0x06 */
bdd8c8
	unsigned char	time_date_stamp			[0x04];		/* 0x08 */
bdd8c8
	unsigned char	ptr_to_sym_tbl			[0x04];		/* 0x0c */
bdd8c8
	unsigned char	num_of_syms			[0x04];		/* 0x10 */
bdd8c8
	unsigned char	size_of_opt_hdr			[0x02];		/* 0x14 */
bdd8c8
	unsigned char	characteristics			[0x02];		/* 0x16 */
feffc7
};
feffc7
feffc7
fad23f
struct pe_raw_opt_hdr_std {
bdd8c8
	unsigned char	magic				[0x02];		/* 0x00 */
bdd8c8
	unsigned char	major_linker_ver		[0x01];		/* 0x02 */
bdd8c8
	unsigned char	minor_linker_ver		[0x01];		/* 0x03 */
bdd8c8
	unsigned char	size_of_code			[0x04];		/* 0x04 */
bdd8c8
	unsigned char	size_of_initialized_data	[0x04];		/* 0x08 */
bdd8c8
	unsigned char	size_of_uninitialized_data	[0x04];		/* 0x0c */
bdd8c8
	unsigned char	entry_point			[0x04];		/* 0x10 */
bdd8c8
	unsigned char	base_of_code			[0x04];		/* 0x14 */
feffc7
};
feffc7
fad23f
struct pe_raw_opt_hdr_align {
bdd8c8
	unsigned char	section_align			[0x04];		/* 0x20 */
bdd8c8
	unsigned char	file_align			[0x04];         /* 0x24 */
feffc7
};
feffc7
fad23f
struct pe_raw_opt_hdr_vers {
bdd8c8
	unsigned char	major_os_ver			[0x02];		/* 0x28 */
bdd8c8
	unsigned char	minor_os_ver			[0x02];		/* 0x2a */
bdd8c8
	unsigned char	major_image_ver			[0x02];		/* 0x2c */
bdd8c8
	unsigned char	minor_image_ver			[0x02];		/* 0x2e */
bdd8c8
	unsigned char	major_subsys_ver		[0x02];		/* 0x30 */
bdd8c8
	unsigned char	minor_subsys_ver		[0x02];		/* 0x32 */
bdd8c8
	unsigned char	win32_ver			[0x04];		/* 0x34 */
feffc7
};
feffc7
fad23f
struct pe_raw_opt_hdr_img {
bdd8c8
	unsigned char	size_of_image			[0x04];		/* 0x38 */
bdd8c8
	unsigned char	size_of_headers			[0x04];		/* 0x3c */
bdd8c8
	unsigned char	checksum			[0x04];		/* 0x40 */
bdd8c8
	unsigned char	subsystem			[0x02];		/* 0x44 */
bdd8c8
	unsigned char	dll_characteristics		[0x02];		/* 0x46 */
feffc7
};
feffc7
fad23f
struct pe_raw_opt_hdr_ldr {
bdd8c8
	unsigned char	loader_flags			[0x04];
bdd8c8
	unsigned char	rva_and_sizes			[0x04];
feffc7
};
feffc7
fad23f
struct pe_raw_opt_hdr_dirs {
bdd8c8
	unsigned char	export_tbl			[0x08];
bdd8c8
	unsigned char	import_tbl			[0x08];
bdd8c8
	unsigned char	resource_tbl			[0x08];
bdd8c8
	unsigned char	exception_tbl			[0x08];
bdd8c8
	unsigned char	certificate_tbl			[0x08];
bdd8c8
	unsigned char	base_reloc_tbl			[0x08];
bdd8c8
	unsigned char	debug				[0x08];
bdd8c8
	unsigned char	arch				[0x08];
bdd8c8
	unsigned char	global_ptr			[0x08];
bdd8c8
	unsigned char	tls_tbl				[0x08];
bdd8c8
	unsigned char	load_config_tbl			[0x08];
bdd8c8
	unsigned char	bound_import			[0x08];
bdd8c8
	unsigned char	iat				[0x08];
bdd8c8
	unsigned char	delay_import_descriptor		[0x08];
bdd8c8
	unsigned char	clr_runtime_hdr			[0x08];
bdd8c8
	unsigned char	reserved			[0x08];
feffc7
};
feffc7
feffc7
struct pe_data_dirs {
bdd8c8
	unsigned char	rva_and_sizes			[0x04];
bdd8c8
	unsigned char	export_tbl			[0x08];
bdd8c8
	unsigned char	import_tbl			[0x08];
bdd8c8
	unsigned char	resource_tbl			[0x08];
bdd8c8
	unsigned char	exception_tbl			[0x08];
bdd8c8
	unsigned char	certificate_tbl			[0x08];
bdd8c8
	unsigned char	base_reloc_tbl			[0x08];
bdd8c8
	unsigned char	debug				[0x08];
bdd8c8
	unsigned char	arch				[0x08];
bdd8c8
	unsigned char	global_ptr			[0x08];
bdd8c8
	unsigned char	tls_tbl				[0x08];
bdd8c8
	unsigned char	load_config_tbl			[0x08];
bdd8c8
	unsigned char	bound_import			[0x08];
bdd8c8
	unsigned char	iat				[0x08];
bdd8c8
	unsigned char	delay_import_descriptor		[0x08];
bdd8c8
	unsigned char	clr_runtime_hdr			[0x08];
bdd8c8
	unsigned char	reserved			[0x08];
feffc7
};
feffc7
fad23f
struct pe_raw_opt_hdr_32 {
bdd8c8
	unsigned char	magic				[0x02];		/* 0x00 */
bdd8c8
	unsigned char	major_linker_ver		[0x01];		/* 0x02 */
bdd8c8
	unsigned char	minor_linker_ver		[0x01];		/* 0x03 */
bdd8c8
	unsigned char	size_of_code			[0x04];		/* 0x04 */
bdd8c8
	unsigned char	size_of_initialized_data	[0x04];		/* 0x08 */
bdd8c8
	unsigned char	size_of_uninitialized_data	[0x04];		/* 0x0c */
bdd8c8
	unsigned char	entry_point			[0x04];		/* 0x10 */
bdd8c8
	unsigned char	base_of_code			[0x04];		/* 0x14 */
bdd8c8
	unsigned char	base_of_data			[0x04];		/* 0x18 */
bdd8c8
	unsigned char	image_base			[0x04];		/* 0x1c */
bdd8c8
	unsigned char	section_align			[0x04];		/* 0x20 */
bdd8c8
	unsigned char	file_align			[0x04];         /* 0x24 */
bdd8c8
	unsigned char	major_os_ver			[0x02];		/* 0x28 */
bdd8c8
	unsigned char	minor_os_ver			[0x02];		/* 0x2a */
bdd8c8
	unsigned char	major_image_ver			[0x02];		/* 0x2c */
bdd8c8
	unsigned char	minor_image_ver			[0x02];		/* 0x2e */
bdd8c8
	unsigned char	major_subsys_ver		[0x02];		/* 0x30 */
bdd8c8
	unsigned char	minor_subsys_ver		[0x02];		/* 0x32 */
bdd8c8
	unsigned char	win32_ver			[0x04];		/* 0x34 */
bdd8c8
	unsigned char	size_of_image			[0x04];		/* 0x38 */
bdd8c8
	unsigned char	size_of_headers			[0x04];		/* 0x3c */
bdd8c8
	unsigned char	checksum			[0x04];		/* 0x40 */
bdd8c8
	unsigned char	subsystem			[0x02];		/* 0x44 */
bdd8c8
	unsigned char	dll_characteristics		[0x02];		/* 0x46 */
bdd8c8
	unsigned char	size_of_stack_reserve		[0x04];		/* 0x48 */
bdd8c8
	unsigned char	size_of_stack_commit		[0x04];		/* 0x4c */
bdd8c8
	unsigned char	size_of_heap_reserve		[0x04];		/* 0x50 */
bdd8c8
	unsigned char	size_of_heap_commit		[0x04];		/* 0x54 */
bdd8c8
	unsigned char	loader_flags			[0x04];		/* 0x58 */
bdd8c8
	unsigned char	rva_and_sizes			[0x04];		/* 0x5c */
bdd8c8
	unsigned char	export_tbl			[0x08];		/* 0x60 */
bdd8c8
	unsigned char	import_tbl			[0x08];		/* 0x68 */
bdd8c8
	unsigned char	resource_tbl			[0x08];		/* 0x70 */
bdd8c8
	unsigned char	exception_tbl			[0x08];		/* 0x78 */
bdd8c8
	unsigned char	certificate_tbl			[0x08];		/* 0x80 */
bdd8c8
	unsigned char	base_reloc_tbl			[0x08];		/* 0x88 */
bdd8c8
	unsigned char	debug				[0x08];		/* 0x90 */
bdd8c8
	unsigned char	arch				[0x08];		/* 0x98 */
bdd8c8
	unsigned char	global_ptr			[0x08];		/* 0xa0 */
bdd8c8
	unsigned char	tls_tbl				[0x08];		/* 0xa8 */
bdd8c8
	unsigned char	load_config_tbl			[0x08];		/* 0xb0 */
bdd8c8
	unsigned char	bound_import			[0x08];		/* 0xb8 */
bdd8c8
	unsigned char	iat				[0x08];		/* 0xc0 */
bdd8c8
	unsigned char	delay_import_descriptor		[0x08];		/* 0xc8 */
bdd8c8
	unsigned char	clr_runtime_hdr			[0x08];		/* 0xd0 */
bdd8c8
	unsigned char	reserved			[0x08];		/* 0xd8 */
feffc7
};
feffc7
feffc7
fad23f
struct pe_raw_opt_hdr_64 {
bdd8c8
	unsigned char	magic				[0x02];		/* 0x00 */
bdd8c8
	unsigned char	major_linker_ver		[0x01];		/* 0x02 */
bdd8c8
	unsigned char	minor_linker_ver		[0x01];		/* 0x03 */
bdd8c8
	unsigned char	size_of_code			[0x04];		/* 0x04 */
bdd8c8
	unsigned char	size_of_initialized_data	[0x04];		/* 0x08 */
bdd8c8
	unsigned char	size_of_uninitialized_data	[0x04];		/* 0x0c */
bdd8c8
	unsigned char	entry_point			[0x04];		/* 0x10 */
bdd8c8
	unsigned char	base_of_code			[0x04];		/* 0x14 */
bdd8c8
	unsigned char	image_base			[0x08];		/* 0x18 */
bdd8c8
	unsigned char	section_align			[0x04];		/* 0x20 */
bdd8c8
	unsigned char	file_align			[0x04];         /* 0x24 */
bdd8c8
	unsigned char	major_os_ver			[0x02];		/* 0x28 */
bdd8c8
	unsigned char	minor_os_ver			[0x02];		/* 0x2a */
bdd8c8
	unsigned char	major_image_ver			[0x02];		/* 0x2c */
bdd8c8
	unsigned char	minor_image_ver			[0x02];		/* 0x2e */
bdd8c8
	unsigned char	major_subsys_ver		[0x02];		/* 0x30 */
bdd8c8
	unsigned char	minor_subsys_ver		[0x02];		/* 0x32 */
bdd8c8
	unsigned char	win32_ver			[0x04];		/* 0x34 */
bdd8c8
	unsigned char	size_of_image			[0x04];		/* 0x38 */
bdd8c8
	unsigned char	size_of_headers			[0x04];		/* 0x3c */
bdd8c8
	unsigned char	checksum			[0x04];		/* 0x40 */
bdd8c8
	unsigned char	subsystem			[0x02];		/* 0x44 */
bdd8c8
	unsigned char	dll_characteristics		[0x02];		/* 0x46 */
bdd8c8
	unsigned char	size_of_stack_reserve		[0x08];		/* 0x48 */
bdd8c8
	unsigned char	size_of_stack_commit		[0x08];		/* 0x50 */
bdd8c8
	unsigned char	size_of_heap_reserve		[0x08];		/* 0x58 */
bdd8c8
	unsigned char	size_of_heap_commit		[0x08];		/* 0x60 */
bdd8c8
	unsigned char	loader_flags			[0x04];		/* 0x68 */
bdd8c8
	unsigned char	rva_and_sizes			[0x04];		/* 0x6c */
bdd8c8
	unsigned char	export_tbl			[0x08];		/* 0x70 */
bdd8c8
	unsigned char	import_tbl			[0x08];		/* 0x78 */
bdd8c8
	unsigned char	resource_tbl			[0x08];		/* 0x80 */
bdd8c8
	unsigned char	exception_tbl			[0x08];		/* 0x88 */
bdd8c8
	unsigned char	certificate_tbl			[0x08];		/* 0x90 */
bdd8c8
	unsigned char	base_reloc_tbl			[0x08];		/* 0x98 */
bdd8c8
	unsigned char	debug				[0x08];		/* 0xa0 */
bdd8c8
	unsigned char	arch				[0x08];		/* 0xa8 */
bdd8c8
	unsigned char	global_ptr			[0x08];		/* 0xb0 */
bdd8c8
	unsigned char	tls_tbl				[0x08];		/* 0xb8 */
bdd8c8
	unsigned char	load_config_tbl			[0x08];		/* 0xc0 */
bdd8c8
	unsigned char	bound_import			[0x08];		/* 0xc8 */
bdd8c8
	unsigned char	iat				[0x08];		/* 0xd0 */
bdd8c8
	unsigned char	delay_import_descriptor		[0x08];		/* 0xd8 */
bdd8c8
	unsigned char	clr_runtime_hdr			[0x08];		/* 0xe0 */
bdd8c8
	unsigned char	reserved			[0x08];		/* 0xe8 */
feffc7
};
feffc7
feffc7
fad23f
union pe_raw_opt_hdr {
fad23f
	struct pe_raw_opt_hdr_32    opt_hdr_32;
fad23f
	struct pe_raw_opt_hdr_64    opt_hdr_64;
feffc7
};
feffc7
feffc7
feffc7
struct pe_image_data_dir {
bdd8c8
	unsigned char	rva				[0x04];		/* 0x00 */
bdd8c8
	unsigned char	size				[0x04];		/* 0x04 */
feffc7
};
feffc7
feffc7
feffc7
struct pe_sec_hdr {
bdd8c8
	unsigned char	name				[0x08];		/* 0x00 */
bdd8c8
	unsigned char	virtual_size			[0x04];		/* 0x08 */
bdd8c8
	unsigned char	virtual_addr			[0x04];		/* 0x0c */
bdd8c8
	unsigned char	size_of_raw_data		[0x04];		/* 0x10 */
bdd8c8
	unsigned char	ptr_to_raw_data			[0x04];		/* 0x14 */
bdd8c8
	unsigned char	ptr_to_relocs			[0x04];		/* 0x18 */
bdd8c8
	unsigned char	ptr_to_line_nums		[0x04];		/* 0x1c */
bdd8c8
	unsigned char	num_of_relocs			[0x02];		/* 0x20 */
bdd8c8
	unsigned char	num_of_line_nums		[0x02];		/* 0x22 */
bdd8c8
	unsigned char	characteristics			[0x04];		/* 0x24 */
feffc7
};
feffc7
feffc7
feffc7
struct pe_export_hdr {
bdd8c8
	unsigned char	export_flags			[0x04];		/* 0x00 */
bdd8c8
	unsigned char	time_date_stamp			[0x04];		/* 0x04 */
bdd8c8
	unsigned char	major_ver			[0x02];		/* 0x08 */
bdd8c8
	unsigned char	minor_ver			[0x02];		/* 0x0a */
bdd8c8
	unsigned char	name_rva			[0x04];		/* 0x0c */
bdd8c8
	unsigned char	ordinal_base			[0x04];		/* 0x10 */
bdd8c8
	unsigned char	addr_tbl_entries		[0x04];		/* 0x14 */
bdd8c8
	unsigned char	num_of_name_ptrs		[0x04];		/* 0x18 */
bdd8c8
	unsigned char	export_addr_tbl_rva		[0x04];		/* 0x1c */
bdd8c8
	unsigned char	name_ptr_rva			[0x04];		/* 0x20 */
bdd8c8
	unsigned char	ordinal_tbl_rva			[0x04];		/* 0x24 */
feffc7
};
feffc7
feffc7
feffc7
union pe_export_addr_tbl {
bdd8c8
	unsigned char	  export_rva			[0x04];		/* 0x00 */
bdd8c8
	unsigned char	  forwarder_rva			[0x04];		/* 0x00 */
feffc7
};
feffc7
feffc7
bdd8c8
union pe_import_lookup_item {
bdd8c8
	unsigned char	import_lookup_entry_64		[0x08];		/* 0x00 */
bdd8c8
	unsigned char	import_lookup_entry_32		[0x04];		/* 0x00 */
bdd8c8
	unsigned char	hint_name_tbl_rva		[0x04];		/* 0x00 */
bdd8c8
	unsigned char	ordinal_number			[0x02];		/* 0x00 */
feffc7
};
feffc7
feffc7
feffc7
struct pe_import_hdr {
bdd8c8
	unsigned char	import_lookup_tbl_rva		[0x04];		/* 0x00 */
bdd8c8
	unsigned char	time_date_stamp			[0x04];		/* 0x04 */
bdd8c8
	unsigned char	forwarder_chain			[0x04];		/* 0x08 */
bdd8c8
	unsigned char	name_rva			[0x04];		/* 0x0c */
bdd8c8
	unsigned char	import_addr_tbl_rva		[0x04];		/* 0x10 */
feffc7
};
feffc7
feffc7
feffc7
struct pe_hint_name_entry {
bdd8c8
	unsigned char	hint				[0x02];		/* 0x00 */
bdd8c8
	unsigned char	name				[0x02];		/* 0x02 */
feffc7
};
feffc7
feffc7
3ec8e9
struct pe_coff_symbol {
3ec8e9
	unsigned char	name				[0x08];		/* 0x00 */
3ec8e9
	unsigned char	value				[0x04];		/* 0x08 */
3ec8e9
	unsigned char	section_number			[0x02];		/* 0x0c */
3ec8e9
	unsigned char	type				[0x02];		/* 0x0e */
3ec8e9
	unsigned char	storage_class			[0x01];		/* 0x10 */
3ec8e9
	unsigned char	num_of_aux_symbols		[0x01];		/* 0x11 */
3ec8e9
};
3ec8e9
3ec8e9
struct pe_coff_symbol_name {
3ec8e9
	union {
3ec8e9
		unsigned char		short_name	[0x08];		/* 0x00 */
3ec8e9
3ec8e9
		struct {
3ec8e9
			unsigned char	zeroes		[0x04];		/* 0x00 */
3ec8e9
			unsigned char	offset		[0x04];		/* 0x04 */
3ec8e9
		} long_name;
3ec8e9
	};
3ec8e9
};
3ec8e9
feffc7
#ifdef __cplusplus
feffc7
}
feffc7
#endif
feffc7
feffc7
#endif