#![allow(missing_docs)]
use crate::endian::{LittleEndian as LE, U16Bytes, U32Bytes, I32, U16, U32, U64};
use crate::pod::Pod;
pub const IMAGE_DOS_SIGNATURE: u16 = 0x5A4D;
pub const IMAGE_OS2_SIGNATURE: u16 = 0x454E;
pub const IMAGE_OS2_SIGNATURE_LE: u16 = 0x454C;
pub const IMAGE_VXD_SIGNATURE: u16 = 0x454C;
pub const IMAGE_NT_SIGNATURE: u32 = 0x0000_4550;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDosHeader {
pub e_magic: U16<LE>,
pub e_cblp: U16<LE>,
pub e_cp: U16<LE>,
pub e_crlc: U16<LE>,
pub e_cparhdr: U16<LE>,
pub e_minalloc: U16<LE>,
pub e_maxalloc: U16<LE>,
pub e_ss: U16<LE>,
pub e_sp: U16<LE>,
pub e_csum: U16<LE>,
pub e_ip: U16<LE>,
pub e_cs: U16<LE>,
pub e_lfarlc: U16<LE>,
pub e_ovno: U16<LE>,
pub e_res: [U16<LE>; 4],
pub e_oemid: U16<LE>,
pub e_oeminfo: U16<LE>,
pub e_res2: [U16<LE>; 10],
pub e_lfanew: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageOs2Header {
pub ne_magic: U16<LE>,
pub ne_ver: i8,
pub ne_rev: i8,
pub ne_enttab: U16<LE>,
pub ne_cbenttab: U16<LE>,
pub ne_crc: I32<LE>,
pub ne_flags: U16<LE>,
pub ne_autodata: U16<LE>,
pub ne_heap: U16<LE>,
pub ne_stack: U16<LE>,
pub ne_csip: I32<LE>,
pub ne_sssp: I32<LE>,
pub ne_cseg: U16<LE>,
pub ne_cmod: U16<LE>,
pub ne_cbnrestab: U16<LE>,
pub ne_segtab: U16<LE>,
pub ne_rsrctab: U16<LE>,
pub ne_restab: U16<LE>,
pub ne_modtab: U16<LE>,
pub ne_imptab: U16<LE>,
pub ne_nrestab: I32<LE>,
pub ne_cmovent: U16<LE>,
pub ne_align: U16<LE>,
pub ne_cres: U16<LE>,
pub ne_exetyp: u8,
pub ne_flagsothers: u8,
pub ne_pretthunks: U16<LE>,
pub ne_psegrefbytes: U16<LE>,
pub ne_swaparea: U16<LE>,
pub ne_expver: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageVxdHeader {
pub e32_magic: U16<LE>,
pub e32_border: u8,
pub e32_worder: u8,
pub e32_level: U32<LE>,
pub e32_cpu: U16<LE>,
pub e32_os: U16<LE>,
pub e32_ver: U32<LE>,
pub e32_mflags: U32<LE>,
pub e32_mpages: U32<LE>,
pub e32_startobj: U32<LE>,
pub e32_eip: U32<LE>,
pub e32_stackobj: U32<LE>,
pub e32_esp: U32<LE>,
pub e32_pagesize: U32<LE>,
pub e32_lastpagesize: U32<LE>,
pub e32_fixupsize: U32<LE>,
pub e32_fixupsum: U32<LE>,
pub e32_ldrsize: U32<LE>,
pub e32_ldrsum: U32<LE>,
pub e32_objtab: U32<LE>,
pub e32_objcnt: U32<LE>,
pub e32_objmap: U32<LE>,
pub e32_itermap: U32<LE>,
pub e32_rsrctab: U32<LE>,
pub e32_rsrccnt: U32<LE>,
pub e32_restab: U32<LE>,
pub e32_enttab: U32<LE>,
pub e32_dirtab: U32<LE>,
pub e32_dircnt: U32<LE>,
pub e32_fpagetab: U32<LE>,
pub e32_frectab: U32<LE>,
pub e32_impmod: U32<LE>,
pub e32_impmodcnt: U32<LE>,
pub e32_impproc: U32<LE>,
pub e32_pagesum: U32<LE>,
pub e32_datapage: U32<LE>,
pub e32_preload: U32<LE>,
pub e32_nrestab: U32<LE>,
pub e32_cbnrestab: U32<LE>,
pub e32_nressum: U32<LE>,
pub e32_autodata: U32<LE>,
pub e32_debuginfo: U32<LE>,
pub e32_debuglen: U32<LE>,
pub e32_instpreload: U32<LE>,
pub e32_instdemand: U32<LE>,
pub e32_heapsize: U32<LE>,
pub e32_res3: [u8; 12],
pub e32_winresoff: U32<LE>,
pub e32_winreslen: U32<LE>,
pub e32_devid: U16<LE>,
pub e32_ddkver: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageFileHeader {
pub machine: U16<LE>,
pub number_of_sections: U16<LE>,
pub time_date_stamp: U32<LE>,
pub pointer_to_symbol_table: U32<LE>,
pub number_of_symbols: U32<LE>,
pub size_of_optional_header: U16<LE>,
pub characteristics: U16<LE>,
}
pub const IMAGE_SIZEOF_FILE_HEADER: usize = 20;
pub const IMAGE_FILE_RELOCS_STRIPPED: u16 = 0x0001;
pub const IMAGE_FILE_EXECUTABLE_IMAGE: u16 = 0x0002;
pub const IMAGE_FILE_LINE_NUMS_STRIPPED: u16 = 0x0004;
pub const IMAGE_FILE_LOCAL_SYMS_STRIPPED: u16 = 0x0008;
pub const IMAGE_FILE_AGGRESIVE_WS_TRIM: u16 = 0x0010;
pub const IMAGE_FILE_LARGE_ADDRESS_AWARE: u16 = 0x0020;
pub const IMAGE_FILE_BYTES_REVERSED_LO: u16 = 0x0080;
pub const IMAGE_FILE_32BIT_MACHINE: u16 = 0x0100;
pub const IMAGE_FILE_DEBUG_STRIPPED: u16 = 0x0200;
pub const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP: u16 = 0x0400;
pub const IMAGE_FILE_NET_RUN_FROM_SWAP: u16 = 0x0800;
pub const IMAGE_FILE_SYSTEM: u16 = 0x1000;
pub const IMAGE_FILE_DLL: u16 = 0x2000;
pub const IMAGE_FILE_UP_SYSTEM_ONLY: u16 = 0x4000;
pub const IMAGE_FILE_BYTES_REVERSED_HI: u16 = 0x8000;
pub const IMAGE_FILE_MACHINE_UNKNOWN: u16 = 0;
pub const IMAGE_FILE_MACHINE_TARGET_HOST: u16 = 0x0001;
pub const IMAGE_FILE_MACHINE_I386: u16 = 0x014c;
pub const IMAGE_FILE_MACHINE_R3000: u16 = 0x0162;
pub const IMAGE_FILE_MACHINE_R4000: u16 = 0x0166;
pub const IMAGE_FILE_MACHINE_R10000: u16 = 0x0168;
pub const IMAGE_FILE_MACHINE_WCEMIPSV2: u16 = 0x0169;
pub const IMAGE_FILE_MACHINE_ALPHA: u16 = 0x0184;
pub const IMAGE_FILE_MACHINE_SH3: u16 = 0x01a2;
pub const IMAGE_FILE_MACHINE_SH3DSP: u16 = 0x01a3;
pub const IMAGE_FILE_MACHINE_SH3E: u16 = 0x01a4;
pub const IMAGE_FILE_MACHINE_SH4: u16 = 0x01a6;
pub const IMAGE_FILE_MACHINE_SH5: u16 = 0x01a8;
pub const IMAGE_FILE_MACHINE_ARM: u16 = 0x01c0;
pub const IMAGE_FILE_MACHINE_THUMB: u16 = 0x01c2;
pub const IMAGE_FILE_MACHINE_ARMNT: u16 = 0x01c4;
pub const IMAGE_FILE_MACHINE_AM33: u16 = 0x01d3;
pub const IMAGE_FILE_MACHINE_POWERPC: u16 = 0x01F0;
pub const IMAGE_FILE_MACHINE_POWERPCFP: u16 = 0x01f1;
pub const IMAGE_FILE_MACHINE_IA64: u16 = 0x0200;
pub const IMAGE_FILE_MACHINE_MIPS16: u16 = 0x0266;
pub const IMAGE_FILE_MACHINE_ALPHA64: u16 = 0x0284;
pub const IMAGE_FILE_MACHINE_MIPSFPU: u16 = 0x0366;
pub const IMAGE_FILE_MACHINE_MIPSFPU16: u16 = 0x0466;
pub const IMAGE_FILE_MACHINE_AXP64: u16 = IMAGE_FILE_MACHINE_ALPHA64;
pub const IMAGE_FILE_MACHINE_TRICORE: u16 = 0x0520;
pub const IMAGE_FILE_MACHINE_CEF: u16 = 0x0CEF;
pub const IMAGE_FILE_MACHINE_EBC: u16 = 0x0EBC;
pub const IMAGE_FILE_MACHINE_AMD64: u16 = 0x8664;
pub const IMAGE_FILE_MACHINE_M32R: u16 = 0x9041;
pub const IMAGE_FILE_MACHINE_ARM64: u16 = 0xAA64;
pub const IMAGE_FILE_MACHINE_CEE: u16 = 0xC0EE;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDataDirectory {
pub virtual_address: U32<LE>,
pub size: U32<LE>,
}
pub const IMAGE_NUMBEROF_DIRECTORY_ENTRIES: usize = 16;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageOptionalHeader32 {
pub magic: U16<LE>,
pub major_linker_version: u8,
pub minor_linker_version: u8,
pub size_of_code: U32<LE>,
pub size_of_initialized_data: U32<LE>,
pub size_of_uninitialized_data: U32<LE>,
pub address_of_entry_point: U32<LE>,
pub base_of_code: U32<LE>,
pub base_of_data: U32<LE>,
pub image_base: U32<LE>,
pub section_alignment: U32<LE>,
pub file_alignment: U32<LE>,
pub major_operating_system_version: U16<LE>,
pub minor_operating_system_version: U16<LE>,
pub major_image_version: U16<LE>,
pub minor_image_version: U16<LE>,
pub major_subsystem_version: U16<LE>,
pub minor_subsystem_version: U16<LE>,
pub win32_version_value: U32<LE>,
pub size_of_image: U32<LE>,
pub size_of_headers: U32<LE>,
pub check_sum: U32<LE>,
pub subsystem: U16<LE>,
pub dll_characteristics: U16<LE>,
pub size_of_stack_reserve: U32<LE>,
pub size_of_stack_commit: U32<LE>,
pub size_of_heap_reserve: U32<LE>,
pub size_of_heap_commit: U32<LE>,
pub loader_flags: U32<LE>,
pub number_of_rva_and_sizes: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageRomOptionalHeader {
pub magic: U16<LE>,
pub major_linker_version: u8,
pub minor_linker_version: u8,
pub size_of_code: U32<LE>,
pub size_of_initialized_data: U32<LE>,
pub size_of_uninitialized_data: U32<LE>,
pub address_of_entry_point: U32<LE>,
pub base_of_code: U32<LE>,
pub base_of_data: U32<LE>,
pub base_of_bss: U32<LE>,
pub gpr_mask: U32<LE>,
pub cpr_mask: [U32<LE>; 4],
pub gp_value: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageOptionalHeader64 {
pub magic: U16<LE>,
pub major_linker_version: u8,
pub minor_linker_version: u8,
pub size_of_code: U32<LE>,
pub size_of_initialized_data: U32<LE>,
pub size_of_uninitialized_data: U32<LE>,
pub address_of_entry_point: U32<LE>,
pub base_of_code: U32<LE>,
pub image_base: U64<LE>,
pub section_alignment: U32<LE>,
pub file_alignment: U32<LE>,
pub major_operating_system_version: U16<LE>,
pub minor_operating_system_version: U16<LE>,
pub major_image_version: U16<LE>,
pub minor_image_version: U16<LE>,
pub major_subsystem_version: U16<LE>,
pub minor_subsystem_version: U16<LE>,
pub win32_version_value: U32<LE>,
pub size_of_image: U32<LE>,
pub size_of_headers: U32<LE>,
pub check_sum: U32<LE>,
pub subsystem: U16<LE>,
pub dll_characteristics: U16<LE>,
pub size_of_stack_reserve: U64<LE>,
pub size_of_stack_commit: U64<LE>,
pub size_of_heap_reserve: U64<LE>,
pub size_of_heap_commit: U64<LE>,
pub loader_flags: U32<LE>,
pub number_of_rva_and_sizes: U32<LE>,
}
pub const IMAGE_NT_OPTIONAL_HDR32_MAGIC: u16 = 0x10b;
pub const IMAGE_NT_OPTIONAL_HDR64_MAGIC: u16 = 0x20b;
pub const IMAGE_ROM_OPTIONAL_HDR_MAGIC: u16 = 0x107;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageNtHeaders64 {
pub signature: U32<LE>,
pub file_header: ImageFileHeader,
pub optional_header: ImageOptionalHeader64,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageNtHeaders32 {
pub signature: U32<LE>,
pub file_header: ImageFileHeader,
pub optional_header: ImageOptionalHeader32,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageRomHeaders {
pub file_header: ImageFileHeader,
pub optional_header: ImageRomOptionalHeader,
}
pub const IMAGE_SUBSYSTEM_UNKNOWN: u16 = 0;
pub const IMAGE_SUBSYSTEM_NATIVE: u16 = 1;
pub const IMAGE_SUBSYSTEM_WINDOWS_GUI: u16 = 2;
pub const IMAGE_SUBSYSTEM_WINDOWS_CUI: u16 = 3;
pub const IMAGE_SUBSYSTEM_OS2_CUI: u16 = 5;
pub const IMAGE_SUBSYSTEM_POSIX_CUI: u16 = 7;
pub const IMAGE_SUBSYSTEM_NATIVE_WINDOWS: u16 = 8;
pub const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI: u16 = 9;
pub const IMAGE_SUBSYSTEM_EFI_APPLICATION: u16 = 10;
pub const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER: u16 = 11;
pub const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER: u16 = 12;
pub const IMAGE_SUBSYSTEM_EFI_ROM: u16 = 13;
pub const IMAGE_SUBSYSTEM_XBOX: u16 = 14;
pub const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION: u16 = 16;
pub const IMAGE_SUBSYSTEM_XBOX_CODE_CATALOG: u16 = 17;
pub const IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA: u16 = 0x0020;
pub const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE: u16 = 0x0040;
pub const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY: u16 = 0x0080;
pub const IMAGE_DLLCHARACTERISTICS_NX_COMPAT: u16 = 0x0100;
pub const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION: u16 = 0x0200;
pub const IMAGE_DLLCHARACTERISTICS_NO_SEH: u16 = 0x0400;
pub const IMAGE_DLLCHARACTERISTICS_NO_BIND: u16 = 0x0800;
pub const IMAGE_DLLCHARACTERISTICS_APPCONTAINER: u16 = 0x1000;
pub const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER: u16 = 0x2000;
pub const IMAGE_DLLCHARACTERISTICS_GUARD_CF: u16 = 0x4000;
pub const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE: u16 = 0x8000;
pub const IMAGE_DIRECTORY_ENTRY_EXPORT: usize = 0;
pub const IMAGE_DIRECTORY_ENTRY_IMPORT: usize = 1;
pub const IMAGE_DIRECTORY_ENTRY_RESOURCE: usize = 2;
pub const IMAGE_DIRECTORY_ENTRY_EXCEPTION: usize = 3;
pub const IMAGE_DIRECTORY_ENTRY_SECURITY: usize = 4;
pub const IMAGE_DIRECTORY_ENTRY_BASERELOC: usize = 5;
pub const IMAGE_DIRECTORY_ENTRY_DEBUG: usize = 6;
pub const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE: usize = 7;
pub const IMAGE_DIRECTORY_ENTRY_GLOBALPTR: usize = 8;
pub const IMAGE_DIRECTORY_ENTRY_TLS: usize = 9;
pub const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG: usize = 10;
pub const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT: usize = 11;
pub const IMAGE_DIRECTORY_ENTRY_IAT: usize = 12;
pub const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT: usize = 13;
pub const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR: usize = 14;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct Guid {
pub data1: U32<LE>,
pub data2: U16<LE>,
pub data3: U16<LE>,
pub data4: [u8; 8],
}
pub type ClsId = Guid;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct AnonObjectHeader {
pub sig1: U16<LE>,
pub sig2: U16<LE>,
pub version: U16<LE>,
pub machine: U16<LE>,
pub time_date_stamp: U32<LE>,
pub class_id: ClsId,
pub size_of_data: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct AnonObjectHeaderV2 {
pub sig1: U16<LE>,
pub sig2: U16<LE>,
pub version: U16<LE>,
pub machine: U16<LE>,
pub time_date_stamp: U32<LE>,
pub class_id: ClsId,
pub size_of_data: U32<LE>,
pub flags: U32<LE>,
pub meta_data_size: U32<LE>,
pub meta_data_offset: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct AnonObjectHeaderBigobj {
pub sig1: U16<LE>,
pub sig2: U16<LE>,
pub version: U16<LE>,
pub machine: U16<LE>,
pub time_date_stamp: U32<LE>,
pub class_id: ClsId,
pub size_of_data: U32<LE>,
pub flags: U32<LE>,
pub meta_data_size: U32<LE>,
pub meta_data_offset: U32<LE>,
pub number_of_sections: U32<LE>,
pub pointer_to_symbol_table: U32<LE>,
pub number_of_symbols: U32<LE>,
}
pub const IMAGE_SIZEOF_SHORT_NAME: usize = 8;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSectionHeader {
pub name: [u8; IMAGE_SIZEOF_SHORT_NAME],
pub virtual_size: U32<LE>,
pub virtual_address: U32<LE>,
pub size_of_raw_data: U32<LE>,
pub pointer_to_raw_data: U32<LE>,
pub pointer_to_relocations: U32<LE>,
pub pointer_to_linenumbers: U32<LE>,
pub number_of_relocations: U16<LE>,
pub number_of_linenumbers: U16<LE>,
pub characteristics: U32<LE>,
}
pub const IMAGE_SIZEOF_SECTION_HEADER: usize = 40;
pub const IMAGE_SCN_TYPE_NO_PAD: u32 = 0x0000_0008;
pub const IMAGE_SCN_CNT_CODE: u32 = 0x0000_0020;
pub const IMAGE_SCN_CNT_INITIALIZED_DATA: u32 = 0x0000_0040;
pub const IMAGE_SCN_CNT_UNINITIALIZED_DATA: u32 = 0x0000_0080;
pub const IMAGE_SCN_LNK_OTHER: u32 = 0x0000_0100;
pub const IMAGE_SCN_LNK_INFO: u32 = 0x0000_0200;
pub const IMAGE_SCN_LNK_REMOVE: u32 = 0x0000_0800;
pub const IMAGE_SCN_LNK_COMDAT: u32 = 0x0000_1000;
pub const IMAGE_SCN_NO_DEFER_SPEC_EXC: u32 = 0x0000_4000;
pub const IMAGE_SCN_GPREL: u32 = 0x0000_8000;
pub const IMAGE_SCN_MEM_FARDATA: u32 = 0x0000_8000;
pub const IMAGE_SCN_MEM_PURGEABLE: u32 = 0x0002_0000;
pub const IMAGE_SCN_MEM_16BIT: u32 = 0x0002_0000;
pub const IMAGE_SCN_MEM_LOCKED: u32 = 0x0004_0000;
pub const IMAGE_SCN_MEM_PRELOAD: u32 = 0x0008_0000;
pub const IMAGE_SCN_ALIGN_1BYTES: u32 = 0x0010_0000;
pub const IMAGE_SCN_ALIGN_2BYTES: u32 = 0x0020_0000;
pub const IMAGE_SCN_ALIGN_4BYTES: u32 = 0x0030_0000;
pub const IMAGE_SCN_ALIGN_8BYTES: u32 = 0x0040_0000;
pub const IMAGE_SCN_ALIGN_16BYTES: u32 = 0x0050_0000;
pub const IMAGE_SCN_ALIGN_32BYTES: u32 = 0x0060_0000;
pub const IMAGE_SCN_ALIGN_64BYTES: u32 = 0x0070_0000;
pub const IMAGE_SCN_ALIGN_128BYTES: u32 = 0x0080_0000;
pub const IMAGE_SCN_ALIGN_256BYTES: u32 = 0x0090_0000;
pub const IMAGE_SCN_ALIGN_512BYTES: u32 = 0x00A0_0000;
pub const IMAGE_SCN_ALIGN_1024BYTES: u32 = 0x00B0_0000;
pub const IMAGE_SCN_ALIGN_2048BYTES: u32 = 0x00C0_0000;
pub const IMAGE_SCN_ALIGN_4096BYTES: u32 = 0x00D0_0000;
pub const IMAGE_SCN_ALIGN_8192BYTES: u32 = 0x00E0_0000;
pub const IMAGE_SCN_ALIGN_MASK: u32 = 0x00F0_0000;
pub const IMAGE_SCN_LNK_NRELOC_OVFL: u32 = 0x0100_0000;
pub const IMAGE_SCN_MEM_DISCARDABLE: u32 = 0x0200_0000;
pub const IMAGE_SCN_MEM_NOT_CACHED: u32 = 0x0400_0000;
pub const IMAGE_SCN_MEM_NOT_PAGED: u32 = 0x0800_0000;
pub const IMAGE_SCN_MEM_SHARED: u32 = 0x1000_0000;
pub const IMAGE_SCN_MEM_EXECUTE: u32 = 0x2000_0000;
pub const IMAGE_SCN_MEM_READ: u32 = 0x4000_0000;
pub const IMAGE_SCN_MEM_WRITE: u32 = 0x8000_0000;
pub const IMAGE_SCN_SCALE_INDEX: u32 = 0x0000_0001;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSymbol {
pub name: [u8; 8],
pub value: U32Bytes<LE>,
pub section_number: U16Bytes<LE>,
pub typ: U16Bytes<LE>,
pub storage_class: u8,
pub number_of_aux_symbols: u8,
}
pub const IMAGE_SIZEOF_SYMBOL: usize = 18;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSymbolBytes(pub [u8; IMAGE_SIZEOF_SYMBOL]);
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSymbolEx {
pub name: [u8; 8],
pub value: U32Bytes<LE>,
pub section_number: U32Bytes<LE>,
pub typ: U16Bytes<LE>,
pub storage_class: u8,
pub number_of_aux_symbols: u8,
}
pub const IMAGE_SIZEOF_SYMBOL_EX: usize = 20;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSymbolExBytes(pub [u8; IMAGE_SIZEOF_SYMBOL_EX]);
pub const IMAGE_SYM_UNDEFINED: u16 = 0;
pub const IMAGE_SYM_ABSOLUTE: u16 = 0xffff;
pub const IMAGE_SYM_DEBUG: u16 = 0xfffe;
pub const IMAGE_SYM_SECTION_MAX: u16 = 0xFEFF;
pub const IMAGE_SYM_SECTION_MAX_EX: u32 = 0x7fff_ffff;
pub const IMAGE_SYM_TYPE_NULL: u16 = 0x0000;
pub const IMAGE_SYM_TYPE_VOID: u16 = 0x0001;
pub const IMAGE_SYM_TYPE_CHAR: u16 = 0x0002;
pub const IMAGE_SYM_TYPE_SHORT: u16 = 0x0003;
pub const IMAGE_SYM_TYPE_INT: u16 = 0x0004;
pub const IMAGE_SYM_TYPE_LONG: u16 = 0x0005;
pub const IMAGE_SYM_TYPE_FLOAT: u16 = 0x0006;
pub const IMAGE_SYM_TYPE_DOUBLE: u16 = 0x0007;
pub const IMAGE_SYM_TYPE_STRUCT: u16 = 0x0008;
pub const IMAGE_SYM_TYPE_UNION: u16 = 0x0009;
pub const IMAGE_SYM_TYPE_ENUM: u16 = 0x000A;
pub const IMAGE_SYM_TYPE_MOE: u16 = 0x000B;
pub const IMAGE_SYM_TYPE_BYTE: u16 = 0x000C;
pub const IMAGE_SYM_TYPE_WORD: u16 = 0x000D;
pub const IMAGE_SYM_TYPE_UINT: u16 = 0x000E;
pub const IMAGE_SYM_TYPE_DWORD: u16 = 0x000F;
pub const IMAGE_SYM_TYPE_PCODE: u16 = 0x8000;
pub const IMAGE_SYM_DTYPE_NULL: u16 = 0;
pub const IMAGE_SYM_DTYPE_POINTER: u16 = 1;
pub const IMAGE_SYM_DTYPE_FUNCTION: u16 = 2;
pub const IMAGE_SYM_DTYPE_ARRAY: u16 = 3;
pub const IMAGE_SYM_CLASS_END_OF_FUNCTION: u8 = 0xff;
pub const IMAGE_SYM_CLASS_NULL: u8 = 0x00;
pub const IMAGE_SYM_CLASS_AUTOMATIC: u8 = 0x01;
pub const IMAGE_SYM_CLASS_EXTERNAL: u8 = 0x02;
pub const IMAGE_SYM_CLASS_STATIC: u8 = 0x03;
pub const IMAGE_SYM_CLASS_REGISTER: u8 = 0x04;
pub const IMAGE_SYM_CLASS_EXTERNAL_DEF: u8 = 0x05;
pub const IMAGE_SYM_CLASS_LABEL: u8 = 0x06;
pub const IMAGE_SYM_CLASS_UNDEFINED_LABEL: u8 = 0x07;
pub const IMAGE_SYM_CLASS_MEMBER_OF_STRUCT: u8 = 0x08;
pub const IMAGE_SYM_CLASS_ARGUMENT: u8 = 0x09;
pub const IMAGE_SYM_CLASS_STRUCT_TAG: u8 = 0x0A;
pub const IMAGE_SYM_CLASS_MEMBER_OF_UNION: u8 = 0x0B;
pub const IMAGE_SYM_CLASS_UNION_TAG: u8 = 0x0C;
pub const IMAGE_SYM_CLASS_TYPE_DEFINITION: u8 = 0x0D;
pub const IMAGE_SYM_CLASS_UNDEFINED_STATIC: u8 = 0x0E;
pub const IMAGE_SYM_CLASS_ENUM_TAG: u8 = 0x0F;
pub const IMAGE_SYM_CLASS_MEMBER_OF_ENUM: u8 = 0x10;
pub const IMAGE_SYM_CLASS_REGISTER_PARAM: u8 = 0x11;
pub const IMAGE_SYM_CLASS_BIT_FIELD: u8 = 0x12;
pub const IMAGE_SYM_CLASS_FAR_EXTERNAL: u8 = 0x44;
pub const IMAGE_SYM_CLASS_BLOCK: u8 = 0x64;
pub const IMAGE_SYM_CLASS_FUNCTION: u8 = 0x65;
pub const IMAGE_SYM_CLASS_END_OF_STRUCT: u8 = 0x66;
pub const IMAGE_SYM_CLASS_FILE: u8 = 0x67;
pub const IMAGE_SYM_CLASS_SECTION: u8 = 0x68;
pub const IMAGE_SYM_CLASS_WEAK_EXTERNAL: u8 = 0x69;
pub const IMAGE_SYM_CLASS_CLR_TOKEN: u8 = 0x6B;
pub const N_BTMASK: u16 = 0x000F;
pub const N_TMASK: u16 = 0x0030;
pub const N_TMASK1: u16 = 0x00C0;
pub const N_TMASK2: u16 = 0x00F0;
pub const N_BTSHFT: usize = 4;
pub const N_TSHIFT: usize = 2;
pub const IMAGE_SYM_DTYPE_SHIFT: usize = N_BTSHFT;
impl ImageSymbol {
#[inline]
pub fn base_type(&self) -> u16 {
self.typ.get(LE) & N_BTMASK
}
#[inline]
pub fn derived_type(&self) -> u16 {
(self.typ.get(LE) & N_TMASK) >> N_BTSHFT
}
}
impl ImageSymbolEx {
#[inline]
pub fn base_type(&self) -> u16 {
self.typ.get(LE) & N_BTMASK
}
#[inline]
pub fn derived_type(&self) -> u16 {
(self.typ.get(LE) & N_TMASK) >> N_BTSHFT
}
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolTokenDef {
pub aux_type: u8,
pub reserved1: u8,
pub symbol_table_index: U32Bytes<LE>,
pub reserved2: [u8; 12],
}
pub const IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF: u16 = 1;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolFunction {
pub tag_index: U32Bytes<LE>,
pub total_size: U32Bytes<LE>,
pub pointer_to_linenumber: U32Bytes<LE>,
pub pointer_to_next_function: U32Bytes<LE>,
pub unused: [u8; 2],
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolFunctionBeginEnd {
pub unused1: [u8; 4],
pub linenumber: U16Bytes<LE>,
pub unused2: [u8; 6],
pub pointer_to_next_function: U32Bytes<LE>,
pub unused3: [u8; 2],
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolWeak {
pub weak_default_sym_index: U32Bytes<LE>,
pub weak_search_type: U32Bytes<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolSection {
pub length: U32Bytes<LE>,
pub number_of_relocations: U16Bytes<LE>,
pub number_of_linenumbers: U16Bytes<LE>,
pub check_sum: U32Bytes<LE>,
pub number: U16Bytes<LE>,
pub selection: u8,
pub reserved: u8,
pub high_number: U16Bytes<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolCrc {
pub crc: U32Bytes<LE>,
}
pub const IMAGE_COMDAT_SELECT_NODUPLICATES: u16 = 1;
pub const IMAGE_COMDAT_SELECT_ANY: u16 = 2;
pub const IMAGE_COMDAT_SELECT_SAME_SIZE: u16 = 3;
pub const IMAGE_COMDAT_SELECT_EXACT_MATCH: u16 = 4;
pub const IMAGE_COMDAT_SELECT_ASSOCIATIVE: u16 = 5;
pub const IMAGE_COMDAT_SELECT_LARGEST: u16 = 6;
pub const IMAGE_COMDAT_SELECT_NEWEST: u16 = 7;
pub const IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY: u16 = 1;
pub const IMAGE_WEAK_EXTERN_SEARCH_LIBRARY: u16 = 2;
pub const IMAGE_WEAK_EXTERN_SEARCH_ALIAS: u16 = 3;
pub const IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY: u16 = 4;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageRelocation {
pub virtual_address: U32Bytes<LE>,
pub symbol_table_index: U32Bytes<LE>,
pub typ: U16Bytes<LE>,
}
pub const IMAGE_REL_I386_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_I386_DIR16: u16 = 0x0001;
pub const IMAGE_REL_I386_REL16: u16 = 0x0002;
pub const IMAGE_REL_I386_DIR32: u16 = 0x0006;
pub const IMAGE_REL_I386_DIR32NB: u16 = 0x0007;
pub const IMAGE_REL_I386_SEG12: u16 = 0x0009;
pub const IMAGE_REL_I386_SECTION: u16 = 0x000A;
pub const IMAGE_REL_I386_SECREL: u16 = 0x000B;
pub const IMAGE_REL_I386_TOKEN: u16 = 0x000C;
pub const IMAGE_REL_I386_SECREL7: u16 = 0x000D;
pub const IMAGE_REL_I386_REL32: u16 = 0x0014;
pub const IMAGE_REL_MIPS_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_MIPS_REFHALF: u16 = 0x0001;
pub const IMAGE_REL_MIPS_REFWORD: u16 = 0x0002;
pub const IMAGE_REL_MIPS_JMPADDR: u16 = 0x0003;
pub const IMAGE_REL_MIPS_REFHI: u16 = 0x0004;
pub const IMAGE_REL_MIPS_REFLO: u16 = 0x0005;
pub const IMAGE_REL_MIPS_GPREL: u16 = 0x0006;
pub const IMAGE_REL_MIPS_LITERAL: u16 = 0x0007;
pub const IMAGE_REL_MIPS_SECTION: u16 = 0x000A;
pub const IMAGE_REL_MIPS_SECREL: u16 = 0x000B;
pub const IMAGE_REL_MIPS_SECRELLO: u16 = 0x000C;
pub const IMAGE_REL_MIPS_SECRELHI: u16 = 0x000D;
pub const IMAGE_REL_MIPS_TOKEN: u16 = 0x000E;
pub const IMAGE_REL_MIPS_JMPADDR16: u16 = 0x0010;
pub const IMAGE_REL_MIPS_REFWORDNB: u16 = 0x0022;
pub const IMAGE_REL_MIPS_PAIR: u16 = 0x0025;
pub const IMAGE_REL_ALPHA_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_ALPHA_REFLONG: u16 = 0x0001;
pub const IMAGE_REL_ALPHA_REFQUAD: u16 = 0x0002;
pub const IMAGE_REL_ALPHA_GPREL32: u16 = 0x0003;
pub const IMAGE_REL_ALPHA_LITERAL: u16 = 0x0004;
pub const IMAGE_REL_ALPHA_LITUSE: u16 = 0x0005;
pub const IMAGE_REL_ALPHA_GPDISP: u16 = 0x0006;
pub const IMAGE_REL_ALPHA_BRADDR: u16 = 0x0007;
pub const IMAGE_REL_ALPHA_HINT: u16 = 0x0008;
pub const IMAGE_REL_ALPHA_INLINE_REFLONG: u16 = 0x0009;
pub const IMAGE_REL_ALPHA_REFHI: u16 = 0x000A;
pub const IMAGE_REL_ALPHA_REFLO: u16 = 0x000B;
pub const IMAGE_REL_ALPHA_PAIR: u16 = 0x000C;
pub const IMAGE_REL_ALPHA_MATCH: u16 = 0x000D;
pub const IMAGE_REL_ALPHA_SECTION: u16 = 0x000E;
pub const IMAGE_REL_ALPHA_SECREL: u16 = 0x000F;
pub const IMAGE_REL_ALPHA_REFLONGNB: u16 = 0x0010;
pub const IMAGE_REL_ALPHA_SECRELLO: u16 = 0x0011;
pub const IMAGE_REL_ALPHA_SECRELHI: u16 = 0x0012;
pub const IMAGE_REL_ALPHA_REFQ3: u16 = 0x0013;
pub const IMAGE_REL_ALPHA_REFQ2: u16 = 0x0014;
pub const IMAGE_REL_ALPHA_REFQ1: u16 = 0x0015;
pub const IMAGE_REL_ALPHA_GPRELLO: u16 = 0x0016;
pub const IMAGE_REL_ALPHA_GPRELHI: u16 = 0x0017;
pub const IMAGE_REL_PPC_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_PPC_ADDR64: u16 = 0x0001;
pub const IMAGE_REL_PPC_ADDR32: u16 = 0x0002;
pub const IMAGE_REL_PPC_ADDR24: u16 = 0x0003;
pub const IMAGE_REL_PPC_ADDR16: u16 = 0x0004;
pub const IMAGE_REL_PPC_ADDR14: u16 = 0x0005;
pub const IMAGE_REL_PPC_REL24: u16 = 0x0006;
pub const IMAGE_REL_PPC_REL14: u16 = 0x0007;
pub const IMAGE_REL_PPC_TOCREL16: u16 = 0x0008;
pub const IMAGE_REL_PPC_TOCREL14: u16 = 0x0009;
pub const IMAGE_REL_PPC_ADDR32NB: u16 = 0x000A;
pub const IMAGE_REL_PPC_SECREL: u16 = 0x000B;
pub const IMAGE_REL_PPC_SECTION: u16 = 0x000C;
pub const IMAGE_REL_PPC_IFGLUE: u16 = 0x000D;
pub const IMAGE_REL_PPC_IMGLUE: u16 = 0x000E;
pub const IMAGE_REL_PPC_SECREL16: u16 = 0x000F;
pub const IMAGE_REL_PPC_REFHI: u16 = 0x0010;
pub const IMAGE_REL_PPC_REFLO: u16 = 0x0011;
pub const IMAGE_REL_PPC_PAIR: u16 = 0x0012;
pub const IMAGE_REL_PPC_SECRELLO: u16 = 0x0013;
pub const IMAGE_REL_PPC_SECRELHI: u16 = 0x0014;
pub const IMAGE_REL_PPC_GPREL: u16 = 0x0015;
pub const IMAGE_REL_PPC_TOKEN: u16 = 0x0016;
pub const IMAGE_REL_PPC_TYPEMASK: u16 = 0x00FF;
pub const IMAGE_REL_PPC_NEG: u16 = 0x0100;
pub const IMAGE_REL_PPC_BRTAKEN: u16 = 0x0200;
pub const IMAGE_REL_PPC_BRNTAKEN: u16 = 0x0400;
pub const IMAGE_REL_PPC_TOCDEFN: u16 = 0x0800;
pub const IMAGE_REL_SH3_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_SH3_DIRECT16: u16 = 0x0001;
pub const IMAGE_REL_SH3_DIRECT32: u16 = 0x0002;
pub const IMAGE_REL_SH3_DIRECT8: u16 = 0x0003;
pub const IMAGE_REL_SH3_DIRECT8_WORD: u16 = 0x0004;
pub const IMAGE_REL_SH3_DIRECT8_LONG: u16 = 0x0005;
pub const IMAGE_REL_SH3_DIRECT4: u16 = 0x0006;
pub const IMAGE_REL_SH3_DIRECT4_WORD: u16 = 0x0007;
pub const IMAGE_REL_SH3_DIRECT4_LONG: u16 = 0x0008;
pub const IMAGE_REL_SH3_PCREL8_WORD: u16 = 0x0009;
pub const IMAGE_REL_SH3_PCREL8_LONG: u16 = 0x000A;
pub const IMAGE_REL_SH3_PCREL12_WORD: u16 = 0x000B;
pub const IMAGE_REL_SH3_STARTOF_SECTION: u16 = 0x000C;
pub const IMAGE_REL_SH3_SIZEOF_SECTION: u16 = 0x000D;
pub const IMAGE_REL_SH3_SECTION: u16 = 0x000E;
pub const IMAGE_REL_SH3_SECREL: u16 = 0x000F;
pub const IMAGE_REL_SH3_DIRECT32_NB: u16 = 0x0010;
pub const IMAGE_REL_SH3_GPREL4_LONG: u16 = 0x0011;
pub const IMAGE_REL_SH3_TOKEN: u16 = 0x0012;
pub const IMAGE_REL_SHM_PCRELPT: u16 = 0x0013;
pub const IMAGE_REL_SHM_REFLO: u16 = 0x0014;
pub const IMAGE_REL_SHM_REFHALF: u16 = 0x0015;
pub const IMAGE_REL_SHM_RELLO: u16 = 0x0016;
pub const IMAGE_REL_SHM_RELHALF: u16 = 0x0017;
pub const IMAGE_REL_SHM_PAIR: u16 = 0x0018;
pub const IMAGE_REL_SH_NOMODE: u16 = 0x8000;
pub const IMAGE_REL_ARM_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_ARM_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_ARM_ADDR32NB: u16 = 0x0002;
pub const IMAGE_REL_ARM_BRANCH24: u16 = 0x0003;
pub const IMAGE_REL_ARM_BRANCH11: u16 = 0x0004;
pub const IMAGE_REL_ARM_TOKEN: u16 = 0x0005;
pub const IMAGE_REL_ARM_GPREL12: u16 = 0x0006;
pub const IMAGE_REL_ARM_GPREL7: u16 = 0x0007;
pub const IMAGE_REL_ARM_BLX24: u16 = 0x0008;
pub const IMAGE_REL_ARM_BLX11: u16 = 0x0009;
pub const IMAGE_REL_ARM_SECTION: u16 = 0x000E;
pub const IMAGE_REL_ARM_SECREL: u16 = 0x000F;
pub const IMAGE_REL_ARM_MOV32A: u16 = 0x0010;
pub const IMAGE_REL_ARM_MOV32: u16 = 0x0010;
pub const IMAGE_REL_ARM_MOV32T: u16 = 0x0011;
pub const IMAGE_REL_THUMB_MOV32: u16 = 0x0011;
pub const IMAGE_REL_ARM_BRANCH20T: u16 = 0x0012;
pub const IMAGE_REL_THUMB_BRANCH20: u16 = 0x0012;
pub const IMAGE_REL_ARM_BRANCH24T: u16 = 0x0014;
pub const IMAGE_REL_THUMB_BRANCH24: u16 = 0x0014;
pub const IMAGE_REL_ARM_BLX23T: u16 = 0x0015;
pub const IMAGE_REL_THUMB_BLX23: u16 = 0x0015;
pub const IMAGE_REL_AM_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_AM_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_AM_ADDR32NB: u16 = 0x0002;
pub const IMAGE_REL_AM_CALL32: u16 = 0x0003;
pub const IMAGE_REL_AM_FUNCINFO: u16 = 0x0004;
pub const IMAGE_REL_AM_REL32_1: u16 = 0x0005;
pub const IMAGE_REL_AM_REL32_2: u16 = 0x0006;
pub const IMAGE_REL_AM_SECREL: u16 = 0x0007;
pub const IMAGE_REL_AM_SECTION: u16 = 0x0008;
pub const IMAGE_REL_AM_TOKEN: u16 = 0x0009;
pub const IMAGE_REL_ARM64_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_ARM64_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_ARM64_ADDR32NB: u16 = 0x0002;
pub const IMAGE_REL_ARM64_BRANCH26: u16 = 0x0003;
pub const IMAGE_REL_ARM64_PAGEBASE_REL21: u16 = 0x0004;
pub const IMAGE_REL_ARM64_REL21: u16 = 0x0005;
pub const IMAGE_REL_ARM64_PAGEOFFSET_12A: u16 = 0x0006;
pub const IMAGE_REL_ARM64_PAGEOFFSET_12L: u16 = 0x0007;
pub const IMAGE_REL_ARM64_SECREL: u16 = 0x0008;
pub const IMAGE_REL_ARM64_SECREL_LOW12A: u16 = 0x0009;
pub const IMAGE_REL_ARM64_SECREL_HIGH12A: u16 = 0x000A;
pub const IMAGE_REL_ARM64_SECREL_LOW12L: u16 = 0x000B;
pub const IMAGE_REL_ARM64_TOKEN: u16 = 0x000C;
pub const IMAGE_REL_ARM64_SECTION: u16 = 0x000D;
pub const IMAGE_REL_ARM64_ADDR64: u16 = 0x000E;
pub const IMAGE_REL_ARM64_BRANCH19: u16 = 0x000F;
pub const IMAGE_REL_AMD64_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_AMD64_ADDR64: u16 = 0x0001;
pub const IMAGE_REL_AMD64_ADDR32: u16 = 0x0002;
pub const IMAGE_REL_AMD64_ADDR32NB: u16 = 0x0003;
pub const IMAGE_REL_AMD64_REL32: u16 = 0x0004;
pub const IMAGE_REL_AMD64_REL32_1: u16 = 0x0005;
pub const IMAGE_REL_AMD64_REL32_2: u16 = 0x0006;
pub const IMAGE_REL_AMD64_REL32_3: u16 = 0x0007;
pub const IMAGE_REL_AMD64_REL32_4: u16 = 0x0008;
pub const IMAGE_REL_AMD64_REL32_5: u16 = 0x0009;
pub const IMAGE_REL_AMD64_SECTION: u16 = 0x000A;
pub const IMAGE_REL_AMD64_SECREL: u16 = 0x000B;
pub const IMAGE_REL_AMD64_SECREL7: u16 = 0x000C;
pub const IMAGE_REL_AMD64_TOKEN: u16 = 0x000D;
pub const IMAGE_REL_AMD64_SREL32: u16 = 0x000E;
pub const IMAGE_REL_AMD64_PAIR: u16 = 0x000F;
pub const IMAGE_REL_AMD64_SSPAN32: u16 = 0x0010;
pub const IMAGE_REL_AMD64_EHANDLER: u16 = 0x0011;
pub const IMAGE_REL_AMD64_IMPORT_BR: u16 = 0x0012;
pub const IMAGE_REL_AMD64_IMPORT_CALL: u16 = 0x0013;
pub const IMAGE_REL_AMD64_CFG_BR: u16 = 0x0014;
pub const IMAGE_REL_AMD64_CFG_BR_REX: u16 = 0x0015;
pub const IMAGE_REL_AMD64_CFG_CALL: u16 = 0x0016;
pub const IMAGE_REL_AMD64_INDIR_BR: u16 = 0x0017;
pub const IMAGE_REL_AMD64_INDIR_BR_REX: u16 = 0x0018;
pub const IMAGE_REL_AMD64_INDIR_CALL: u16 = 0x0019;
pub const IMAGE_REL_AMD64_INDIR_BR_SWITCHTABLE_FIRST: u16 = 0x0020;
pub const IMAGE_REL_AMD64_INDIR_BR_SWITCHTABLE_LAST: u16 = 0x002F;
pub const IMAGE_REL_IA64_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_IA64_IMM14: u16 = 0x0001;
pub const IMAGE_REL_IA64_IMM22: u16 = 0x0002;
pub const IMAGE_REL_IA64_IMM64: u16 = 0x0003;
pub const IMAGE_REL_IA64_DIR32: u16 = 0x0004;
pub const IMAGE_REL_IA64_DIR64: u16 = 0x0005;
pub const IMAGE_REL_IA64_PCREL21B: u16 = 0x0006;
pub const IMAGE_REL_IA64_PCREL21M: u16 = 0x0007;
pub const IMAGE_REL_IA64_PCREL21F: u16 = 0x0008;
pub const IMAGE_REL_IA64_GPREL22: u16 = 0x0009;
pub const IMAGE_REL_IA64_LTOFF22: u16 = 0x000A;
pub const IMAGE_REL_IA64_SECTION: u16 = 0x000B;
pub const IMAGE_REL_IA64_SECREL22: u16 = 0x000C;
pub const IMAGE_REL_IA64_SECREL64I: u16 = 0x000D;
pub const IMAGE_REL_IA64_SECREL32: u16 = 0x000E;
pub const IMAGE_REL_IA64_DIR32NB: u16 = 0x0010;
pub const IMAGE_REL_IA64_SREL14: u16 = 0x0011;
pub const IMAGE_REL_IA64_SREL22: u16 = 0x0012;
pub const IMAGE_REL_IA64_SREL32: u16 = 0x0013;
pub const IMAGE_REL_IA64_UREL32: u16 = 0x0014;
pub const IMAGE_REL_IA64_PCREL60X: u16 = 0x0015;
pub const IMAGE_REL_IA64_PCREL60B: u16 = 0x0016;
pub const IMAGE_REL_IA64_PCREL60F: u16 = 0x0017;
pub const IMAGE_REL_IA64_PCREL60I: u16 = 0x0018;
pub const IMAGE_REL_IA64_PCREL60M: u16 = 0x0019;
pub const IMAGE_REL_IA64_IMMGPREL64: u16 = 0x001A;
pub const IMAGE_REL_IA64_TOKEN: u16 = 0x001B;
pub const IMAGE_REL_IA64_GPREL32: u16 = 0x001C;
pub const IMAGE_REL_IA64_ADDEND: u16 = 0x001F;
pub const IMAGE_REL_CEF_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_CEF_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_CEF_ADDR64: u16 = 0x0002;
pub const IMAGE_REL_CEF_ADDR32NB: u16 = 0x0003;
pub const IMAGE_REL_CEF_SECTION: u16 = 0x0004;
pub const IMAGE_REL_CEF_SECREL: u16 = 0x0005;
pub const IMAGE_REL_CEF_TOKEN: u16 = 0x0006;
pub const IMAGE_REL_CEE_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_CEE_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_CEE_ADDR64: u16 = 0x0002;
pub const IMAGE_REL_CEE_ADDR32NB: u16 = 0x0003;
pub const IMAGE_REL_CEE_SECTION: u16 = 0x0004;
pub const IMAGE_REL_CEE_SECREL: u16 = 0x0005;
pub const IMAGE_REL_CEE_TOKEN: u16 = 0x0006;
pub const IMAGE_REL_M32R_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_M32R_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_M32R_ADDR32NB: u16 = 0x0002;
pub const IMAGE_REL_M32R_ADDR24: u16 = 0x0003;
pub const IMAGE_REL_M32R_GPREL16: u16 = 0x0004;
pub const IMAGE_REL_M32R_PCREL24: u16 = 0x0005;
pub const IMAGE_REL_M32R_PCREL16: u16 = 0x0006;
pub const IMAGE_REL_M32R_PCREL8: u16 = 0x0007;
pub const IMAGE_REL_M32R_REFHALF: u16 = 0x0008;
pub const IMAGE_REL_M32R_REFHI: u16 = 0x0009;
pub const IMAGE_REL_M32R_REFLO: u16 = 0x000A;
pub const IMAGE_REL_M32R_PAIR: u16 = 0x000B;
pub const IMAGE_REL_M32R_SECTION: u16 = 0x000C;
pub const IMAGE_REL_M32R_SECREL32: u16 = 0x000D;
pub const IMAGE_REL_M32R_TOKEN: u16 = 0x000E;
pub const IMAGE_REL_EBC_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_EBC_ADDR32NB: u16 = 0x0001;
pub const IMAGE_REL_EBC_REL32: u16 = 0x0002;
pub const IMAGE_REL_EBC_SECTION: u16 = 0x0003;
pub const IMAGE_REL_EBC_SECREL: u16 = 0x0004;
pub const EMARCH_ENC_I17_IMM7B_INST_WORD_X: u16 = 3;
pub const EMARCH_ENC_I17_IMM7B_SIZE_X: u16 = 7;
pub const EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X: u16 = 4;
pub const EMARCH_ENC_I17_IMM7B_VAL_POS_X: u16 = 0;
pub const EMARCH_ENC_I17_IMM9D_INST_WORD_X: u16 = 3;
pub const EMARCH_ENC_I17_IMM9D_SIZE_X: u16 = 9;
pub const EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X: u16 = 18;
pub const EMARCH_ENC_I17_IMM9D_VAL_POS_X: u16 = 7;
pub const EMARCH_ENC_I17_IMM5C_INST_WORD_X: u16 = 3;
pub const EMARCH_ENC_I17_IMM5C_SIZE_X: u16 = 5;
pub const EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X: u16 = 13;
pub const EMARCH_ENC_I17_IMM5C_VAL_POS_X: u16 = 16;
pub const EMARCH_ENC_I17_IC_INST_WORD_X: u16 = 3;
pub const EMARCH_ENC_I17_IC_SIZE_X: u16 = 1;
pub const EMARCH_ENC_I17_IC_INST_WORD_POS_X: u16 = 12;
pub const EMARCH_ENC_I17_IC_VAL_POS_X: u16 = 21;
pub const EMARCH_ENC_I17_IMM41A_INST_WORD_X: u16 = 1;
pub const EMARCH_ENC_I17_IMM41A_SIZE_X: u16 = 10;
pub const EMARCH_ENC_I17_IMM41A_INST_WORD_POS_X: u16 = 14;
pub const EMARCH_ENC_I17_IMM41A_VAL_POS_X: u16 = 22;
pub const EMARCH_ENC_I17_IMM41B_INST_WORD_X: u16 = 1;
pub const EMARCH_ENC_I17_IMM41B_SIZE_X: u16 = 8;
pub const EMARCH_ENC_I17_IMM41B_INST_WORD_POS_X: u16 = 24;
pub const EMARCH_ENC_I17_IMM41B_VAL_POS_X: u16 = 32;
pub const EMARCH_ENC_I17_IMM41C_INST_WORD_X: u16 = 2;
pub const EMARCH_ENC_I17_IMM41C_SIZE_X: u16 = 23;
pub const EMARCH_ENC_I17_IMM41C_INST_WORD_POS_X: u16 = 0;
pub const EMARCH_ENC_I17_IMM41C_VAL_POS_X: u16 = 40;
pub const EMARCH_ENC_I17_SIGN_INST_WORD_X: u16 = 3;
pub const EMARCH_ENC_I17_SIGN_SIZE_X: u16 = 1;
pub const EMARCH_ENC_I17_SIGN_INST_WORD_POS_X: u16 = 27;
pub const EMARCH_ENC_I17_SIGN_VAL_POS_X: u16 = 63;
pub const X3_OPCODE_INST_WORD_X: u16 = 3;
pub const X3_OPCODE_SIZE_X: u16 = 4;
pub const X3_OPCODE_INST_WORD_POS_X: u16 = 28;
pub const X3_OPCODE_SIGN_VAL_POS_X: u16 = 0;
pub const X3_I_INST_WORD_X: u16 = 3;
pub const X3_I_SIZE_X: u16 = 1;
pub const X3_I_INST_WORD_POS_X: u16 = 27;
pub const X3_I_SIGN_VAL_POS_X: u16 = 59;
pub const X3_D_WH_INST_WORD_X: u16 = 3;
pub const X3_D_WH_SIZE_X: u16 = 3;
pub const X3_D_WH_INST_WORD_POS_X: u16 = 24;
pub const X3_D_WH_SIGN_VAL_POS_X: u16 = 0;
pub const X3_IMM20_INST_WORD_X: u16 = 3;
pub const X3_IMM20_SIZE_X: u16 = 20;
pub const X3_IMM20_INST_WORD_POS_X: u16 = 4;
pub const X3_IMM20_SIGN_VAL_POS_X: u16 = 0;
pub const X3_IMM39_1_INST_WORD_X: u16 = 2;
pub const X3_IMM39_1_SIZE_X: u16 = 23;
pub const X3_IMM39_1_INST_WORD_POS_X: u16 = 0;
pub const X3_IMM39_1_SIGN_VAL_POS_X: u16 = 36;
pub const X3_IMM39_2_INST_WORD_X: u16 = 1;
pub const X3_IMM39_2_SIZE_X: u16 = 16;
pub const X3_IMM39_2_INST_WORD_POS_X: u16 = 16;
pub const X3_IMM39_2_SIGN_VAL_POS_X: u16 = 20;
pub const X3_P_INST_WORD_X: u16 = 3;
pub const X3_P_SIZE_X: u16 = 4;
pub const X3_P_INST_WORD_POS_X: u16 = 0;
pub const X3_P_SIGN_VAL_POS_X: u16 = 0;
pub const X3_TMPLT_INST_WORD_X: u16 = 0;
pub const X3_TMPLT_SIZE_X: u16 = 4;
pub const X3_TMPLT_INST_WORD_POS_X: u16 = 0;
pub const X3_TMPLT_SIGN_VAL_POS_X: u16 = 0;
pub const X3_BTYPE_QP_INST_WORD_X: u16 = 2;
pub const X3_BTYPE_QP_SIZE_X: u16 = 9;
pub const X3_BTYPE_QP_INST_WORD_POS_X: u16 = 23;
pub const X3_BTYPE_QP_INST_VAL_POS_X: u16 = 0;
pub const X3_EMPTY_INST_WORD_X: u16 = 1;
pub const X3_EMPTY_SIZE_X: u16 = 2;
pub const X3_EMPTY_INST_WORD_POS_X: u16 = 14;
pub const X3_EMPTY_INST_VAL_POS_X: u16 = 0;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageLinenumber {
pub symbol_table_index_or_virtual_address: U32Bytes<LE>,
pub linenumber: U16Bytes<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageBaseRelocation {
pub virtual_address: U32Bytes<LE>,
pub size_of_block: U32Bytes<LE>,
}
pub const IMAGE_REL_BASED_ABSOLUTE: u16 = 0;
pub const IMAGE_REL_BASED_HIGH: u16 = 1;
pub const IMAGE_REL_BASED_LOW: u16 = 2;
pub const IMAGE_REL_BASED_HIGHLOW: u16 = 3;
pub const IMAGE_REL_BASED_HIGHADJ: u16 = 4;
pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_5: u16 = 5;
pub const IMAGE_REL_BASED_RESERVED: u16 = 6;
pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_7: u16 = 7;
pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_8: u16 = 8;
pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_9: u16 = 9;
pub const IMAGE_REL_BASED_DIR64: u16 = 10;
pub const IMAGE_REL_BASED_IA64_IMM64: u16 = 9;
pub const IMAGE_REL_BASED_MIPS_JMPADDR: u16 = 5;
pub const IMAGE_REL_BASED_MIPS_JMPADDR16: u16 = 9;
pub const IMAGE_REL_BASED_ARM_MOV32: u16 = 5;
pub const IMAGE_REL_BASED_THUMB_MOV32: u16 = 7;
pub const IMAGE_ARCHIVE_START_SIZE: usize = 8;
pub const IMAGE_ARCHIVE_START: &[u8; 8] = b"!<arch>\n";
pub const IMAGE_ARCHIVE_END: &[u8] = b"`\n";
pub const IMAGE_ARCHIVE_PAD: &[u8] = b"\n";
pub const IMAGE_ARCHIVE_LINKER_MEMBER: &[u8; 16] = b"/ ";
pub const IMAGE_ARCHIVE_LONGNAMES_MEMBER: &[u8; 16] = b"// ";
pub const IMAGE_ARCHIVE_HYBRIDMAP_MEMBER: &[u8; 16] = b"/<HYBRIDMAP>/ ";
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageArchiveMemberHeader {
pub name: [u8; 16],
pub date: [u8; 12],
pub user_id: [u8; 6],
pub group_id: [u8; 6],
pub mode: [u8; 8],
pub size: [u8; 10],
pub end_header: [u8; 2],
}
pub const IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR: u16 = 60;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageExportDirectory {
pub characteristics: U32<LE>,
pub time_date_stamp: U32<LE>,
pub major_version: U16<LE>,
pub minor_version: U16<LE>,
pub name: U32<LE>,
pub base: U32<LE>,
pub number_of_functions: U32<LE>,
pub number_of_names: U32<LE>,
pub address_of_functions: U32<LE>,
pub address_of_names: U32<LE>,
pub address_of_name_ordinals: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageImportByName {
pub hint: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageTlsDirectory64 {
pub start_address_of_raw_data: U64<LE>,
pub end_address_of_raw_data: U64<LE>,
pub address_of_index: U64<LE>,
pub address_of_call_backs: U64<LE>,
pub size_of_zero_fill: U32<LE>,
pub characteristics: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageTlsDirectory32 {
pub start_address_of_raw_data: U32<LE>,
pub end_address_of_raw_data: U32<LE>,
pub address_of_index: U32<LE>,
pub address_of_call_backs: U32<LE>,
pub size_of_zero_fill: U32<LE>,
pub characteristics: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageImportDescriptor {
pub characteristics_or_original_first_thunk: U32<LE>,
pub original_first_thunk: U32<LE>,
pub time_date_stamp: U32<LE>,
pub forwarder_chain: U32<LE>,
pub name: U32<LE>,
pub first_thunk: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageBoundImportDescriptor {
pub time_date_stamp: U32<LE>,
pub offset_module_name: U16<LE>,
pub number_of_module_forwarder_refs: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageBoundForwarderRef {
pub time_date_stamp: U32<LE>,
pub offset_module_name: U16<LE>,
pub reserved: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDelayloadDescriptor {
pub attributes: U32<LE>,
pub dll_name_rva: U32<LE>,
pub module_handle_rva: U32<LE>,
pub import_address_table_rva: U32<LE>,
pub import_name_table_rva: U32<LE>,
pub bound_import_address_table_rva: U32<LE>,
pub unload_information_table_rva: U32<LE>,
pub time_date_stamp: U32<LE>,
}
pub const IMAGE_DELAYLOAD_RVA_BASED: u32 = 0x8000_0000;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageResourceDirectory {
pub characteristics: U32<LE>,
pub time_date_stamp: U32<LE>,
pub major_version: U16<LE>,
pub minor_version: U16<LE>,
pub number_of_named_entries: U16<LE>,
pub number_of_id_entries: U16<LE>,
}
pub const IMAGE_RESOURCE_NAME_IS_STRING: u32 = 0x8000_0000;
pub const IMAGE_RESOURCE_DATA_IS_DIRECTORY: u32 = 0x8000_0000;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageResourceDirectoryEntry {
pub name_or_id: U32<LE>,
pub offset_to_data_or_directory: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageResourceDirectoryString {
pub length: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageResourceDirStringU {
pub length: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageResourceDataEntry {
pub offset_to_data: U32<LE>,
pub size: U32<LE>,
pub code_page: U32<LE>,
pub reserved: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageLoadConfigCodeIntegrity {
pub flags: U16<LE>,
pub catalog: U16<LE>,
pub catalog_offset: U32<LE>,
pub reserved: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDynamicRelocationTable {
pub version: U32<LE>,
pub size: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDynamicRelocation32 {
pub symbol: U32<LE>,
pub base_reloc_size: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDynamicRelocation64 {
pub symbol: U64<LE>,
pub base_reloc_size: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDynamicRelocation32V2 {
pub header_size: U32<LE>,
pub fixup_info_size: U32<LE>,
pub symbol: U32<LE>,
pub symbol_group: U32<LE>,
pub flags: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDynamicRelocation64V2 {
pub header_size: U32<LE>,
pub fixup_info_size: U32<LE>,
pub symbol: U64<LE>,
pub symbol_group: U32<LE>,
pub flags: U32<LE>,
}
pub const IMAGE_DYNAMIC_RELOCATION_GUARD_RF_PROLOGUE: u32 = 0x0000_0001;
pub const IMAGE_DYNAMIC_RELOCATION_GUARD_RF_EPILOGUE: u32 = 0x0000_0002;
pub const IMAGE_DYNAMIC_RELOCATION_GUARD_IMPORT_CONTROL_TRANSFER: u32 = 0x0000_0003;
pub const IMAGE_DYNAMIC_RELOCATION_GUARD_INDIR_CONTROL_TRANSFER: u32 = 0x0000_0004;
pub const IMAGE_DYNAMIC_RELOCATION_GUARD_SWITCHTABLE_BRANCH: u32 = 0x0000_0005;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImagePrologueDynamicRelocationHeader {
pub prologue_byte_count: u8,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageEpilogueDynamicRelocationHeader {
pub epilogue_count: U32Bytes<LE>,
pub epilogue_byte_count: u8,
pub branch_descriptor_element_size: u8,
pub branch_descriptor_count: U16Bytes<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageLoadConfigDirectory32 {
pub size: U32<LE>,
pub time_date_stamp: U32<LE>,
pub major_version: U16<LE>,
pub minor_version: U16<LE>,
pub global_flags_clear: U32<LE>,
pub global_flags_set: U32<LE>,
pub critical_section_default_timeout: U32<LE>,
pub de_commit_free_block_threshold: U32<LE>,
pub de_commit_total_free_threshold: U32<LE>,
pub lock_prefix_table: U32<LE>,
pub maximum_allocation_size: U32<LE>,
pub virtual_memory_threshold: U32<LE>,
pub process_heap_flags: U32<LE>,
pub process_affinity_mask: U32<LE>,
pub csd_version: U16<LE>,
pub dependent_load_flags: U16<LE>,
pub edit_list: U32<LE>,
pub security_cookie: U32<LE>,
pub sehandler_table: U32<LE>,
pub sehandler_count: U32<LE>,
pub guard_cf_check_function_pointer: U32<LE>,
pub guard_cf_dispatch_function_pointer: U32<LE>,
pub guard_cf_function_table: U32<LE>,
pub guard_cf_function_count: U32<LE>,
pub guard_flags: U32<LE>,
pub code_integrity: ImageLoadConfigCodeIntegrity,
pub guard_address_taken_iat_entry_table: U32<LE>,
pub guard_address_taken_iat_entry_count: U32<LE>,
pub guard_long_jump_target_table: U32<LE>,
pub guard_long_jump_target_count: U32<LE>,
pub dynamic_value_reloc_table: U32<LE>,
pub chpe_metadata_pointer: U32<LE>,
pub guard_rf_failure_routine: U32<LE>,
pub guard_rf_failure_routine_function_pointer: U32<LE>,
pub dynamic_value_reloc_table_offset: U32<LE>,
pub dynamic_value_reloc_table_section: U16<LE>,
pub reserved2: U16<LE>,
pub guard_rf_verify_stack_pointer_function_pointer: U32<LE>,
pub hot_patch_table_offset: U32<LE>,
pub reserved3: U32<LE>,
pub enclave_configuration_pointer: U32<LE>,
pub volatile_metadata_pointer: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageLoadConfigDirectory64 {
pub size: U32<LE>,
pub time_date_stamp: U32<LE>,
pub major_version: U16<LE>,
pub minor_version: U16<LE>,
pub global_flags_clear: U32<LE>,
pub global_flags_set: U32<LE>,
pub critical_section_default_timeout: U32<LE>,
pub de_commit_free_block_threshold: U64<LE>,
pub de_commit_total_free_threshold: U64<LE>,
pub lock_prefix_table: U64<LE>,
pub maximum_allocation_size: U64<LE>,
pub virtual_memory_threshold: U64<LE>,
pub process_affinity_mask: U64<LE>,
pub process_heap_flags: U32<LE>,
pub csd_version: U16<LE>,
pub dependent_load_flags: U16<LE>,
pub edit_list: U64<LE>,
pub security_cookie: U64<LE>,
pub sehandler_table: U64<LE>,
pub sehandler_count: U64<LE>,
pub guard_cf_check_function_pointer: U64<LE>,
pub guard_cf_dispatch_function_pointer: U64<LE>,
pub guard_cf_function_table: U64<LE>,
pub guard_cf_function_count: U64<LE>,
pub guard_flags: U32<LE>,
pub code_integrity: ImageLoadConfigCodeIntegrity,
pub guard_address_taken_iat_entry_table: U64<LE>,
pub guard_address_taken_iat_entry_count: U64<LE>,
pub guard_long_jump_target_table: U64<LE>,
pub guard_long_jump_target_count: U64<LE>,
pub dynamic_value_reloc_table: U64<LE>,
pub chpe_metadata_pointer: U64<LE>,
pub guard_rf_failure_routine: U64<LE>,
pub guard_rf_failure_routine_function_pointer: U64<LE>,
pub dynamic_value_reloc_table_offset: U32<LE>,
pub dynamic_value_reloc_table_section: U16<LE>,
pub reserved2: U16<LE>,
pub guard_rf_verify_stack_pointer_function_pointer: U64<LE>,
pub hot_patch_table_offset: U32<LE>,
pub reserved3: U32<LE>,
pub enclave_configuration_pointer: U64<LE>,
pub volatile_metadata_pointer: U64<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageHotPatchInfo {
pub version: U32<LE>,
pub size: U32<LE>,
pub sequence_number: U32<LE>,
pub base_image_list: U32<LE>,
pub base_image_count: U32<LE>,
pub buffer_offset: U32<LE>,
pub extra_patch_size: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageHotPatchBase {
pub sequence_number: U32<LE>,
pub flags: U32<LE>,
pub original_time_date_stamp: U32<LE>,
pub original_check_sum: U32<LE>,
pub code_integrity_info: U32<LE>,
pub code_integrity_size: U32<LE>,
pub patch_table: U32<LE>,
pub buffer_offset: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageHotPatchHashes {
pub sha256: [u8; 32],
pub sha1: [u8; 20],
}
pub const IMAGE_HOT_PATCH_BASE_OBLIGATORY: u32 = 0x0000_0001;
pub const IMAGE_HOT_PATCH_BASE_CAN_ROLL_BACK: u32 = 0x0000_0002;
pub const IMAGE_HOT_PATCH_CHUNK_INVERSE: u32 = 0x8000_0000;
pub const IMAGE_HOT_PATCH_CHUNK_OBLIGATORY: u32 = 0x4000_0000;
pub const IMAGE_HOT_PATCH_CHUNK_RESERVED: u32 = 0x3FF0_3000;
pub const IMAGE_HOT_PATCH_CHUNK_TYPE: u32 = 0x000F_C000;
pub const IMAGE_HOT_PATCH_CHUNK_SOURCE_RVA: u32 = 0x0000_8000;
pub const IMAGE_HOT_PATCH_CHUNK_TARGET_RVA: u32 = 0x0000_4000;
pub const IMAGE_HOT_PATCH_CHUNK_SIZE: u32 = 0x0000_0FFF;
pub const IMAGE_HOT_PATCH_NONE: u32 = 0x0000_0000;
pub const IMAGE_HOT_PATCH_FUNCTION: u32 = 0x0001_C000;
pub const IMAGE_HOT_PATCH_ABSOLUTE: u32 = 0x0002_C000;
pub const IMAGE_HOT_PATCH_REL32: u32 = 0x0003_C000;
pub const IMAGE_HOT_PATCH_CALL_TARGET: u32 = 0x0004_4000;
pub const IMAGE_HOT_PATCH_INDIRECT: u32 = 0x0005_C000;
pub const IMAGE_HOT_PATCH_NO_CALL_TARGET: u32 = 0x0006_4000;
pub const IMAGE_HOT_PATCH_DYNAMIC_VALUE: u32 = 0x0007_8000;
pub const IMAGE_GUARD_CF_INSTRUMENTED: u32 = 0x0000_0100;
pub const IMAGE_GUARD_CFW_INSTRUMENTED: u32 = 0x0000_0200;
pub const IMAGE_GUARD_CF_FUNCTION_TABLE_PRESENT: u32 = 0x0000_0400;
pub const IMAGE_GUARD_SECURITY_COOKIE_UNUSED: u32 = 0x0000_0800;
pub const IMAGE_GUARD_PROTECT_DELAYLOAD_IAT: u32 = 0x0000_1000;
pub const IMAGE_GUARD_DELAYLOAD_IAT_IN_ITS_OWN_SECTION: u32 = 0x0000_2000;
pub const IMAGE_GUARD_CF_EXPORT_SUPPRESSION_INFO_PRESENT: u32 = 0x0000_4000;
pub const IMAGE_GUARD_CF_ENABLE_EXPORT_SUPPRESSION: u32 = 0x0000_8000;
pub const IMAGE_GUARD_CF_LONGJUMP_TABLE_PRESENT: u32 = 0x0001_0000;
pub const IMAGE_GUARD_RF_INSTRUMENTED: u32 = 0x0002_0000;
pub const IMAGE_GUARD_RF_ENABLE: u32 = 0x0004_0000;
pub const IMAGE_GUARD_RF_STRICT: u32 = 0x0008_0000;
pub const IMAGE_GUARD_RETPOLINE_PRESENT: u32 = 0x0010_0000;
pub const IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_MASK: u32 = 0xF000_0000;
pub const IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_SHIFT: u32 = 28;
pub const IMAGE_GUARD_FLAG_FID_SUPPRESSED: u16 = 0x01;
pub const IMAGE_GUARD_FLAG_EXPORT_SUPPRESSED: u16 = 0x02;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageArmRuntimeFunctionEntry {
pub begin_address: U32<LE>,
pub unwind_data: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageArm64RuntimeFunctionEntry {
pub begin_address: U32<LE>,
pub unwind_data: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAlpha64RuntimeFunctionEntry {
pub begin_address: U64<LE>,
pub end_address: U64<LE>,
pub exception_handler: U64<LE>,
pub handler_data: U64<LE>,
pub prolog_end_address: U64<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAlphaRuntimeFunctionEntry {
pub begin_address: U32<LE>,
pub end_address: U32<LE>,
pub exception_handler: U32<LE>,
pub handler_data: U32<LE>,
pub prolog_end_address: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageRuntimeFunctionEntry {
pub begin_address: U32<LE>,
pub end_address: U32<LE>,
pub unwind_info_address_or_data: U32<LE>,
}
pub const IMAGE_ENCLAVE_LONG_ID_LENGTH: usize = 32;
pub const IMAGE_ENCLAVE_SHORT_ID_LENGTH: usize = 16;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageEnclaveConfig32 {
pub size: U32<LE>,
pub minimum_required_config_size: U32<LE>,
pub policy_flags: U32<LE>,
pub number_of_imports: U32<LE>,
pub import_list: U32<LE>,
pub import_entry_size: U32<LE>,
pub family_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub image_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub image_version: U32<LE>,
pub security_version: U32<LE>,
pub enclave_size: U32<LE>,
pub number_of_threads: U32<LE>,
pub enclave_flags: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageEnclaveConfig64 {
pub size: U32<LE>,
pub minimum_required_config_size: U32<LE>,
pub policy_flags: U32<LE>,
pub number_of_imports: U32<LE>,
pub import_list: U32<LE>,
pub import_entry_size: U32<LE>,
pub family_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub image_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub image_version: U32<LE>,
pub security_version: U32<LE>,
pub enclave_size: U64<LE>,
pub number_of_threads: U32<LE>,
pub enclave_flags: U32<LE>,
}
pub const IMAGE_ENCLAVE_POLICY_DEBUGGABLE: u32 = 0x0000_0001;
pub const IMAGE_ENCLAVE_FLAG_PRIMARY_IMAGE: u32 = 0x0000_0001;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageEnclaveImport {
pub match_type: U32<LE>,
pub minimum_security_version: U32<LE>,
pub unique_or_author_id: [u8; IMAGE_ENCLAVE_LONG_ID_LENGTH],
pub family_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub image_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub import_name: U32<LE>,
pub reserved: U32<LE>,
}
pub const IMAGE_ENCLAVE_IMPORT_MATCH_NONE: u32 = 0x0000_0000;
pub const IMAGE_ENCLAVE_IMPORT_MATCH_UNIQUE_ID: u32 = 0x0000_0001;
pub const IMAGE_ENCLAVE_IMPORT_MATCH_AUTHOR_ID: u32 = 0x0000_0002;
pub const IMAGE_ENCLAVE_IMPORT_MATCH_FAMILY_ID: u32 = 0x0000_0003;
pub const IMAGE_ENCLAVE_IMPORT_MATCH_IMAGE_ID: u32 = 0x0000_0004;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDebugDirectory {
pub characteristics: U32<LE>,
pub time_date_stamp: U32<LE>,
pub major_version: U16<LE>,
pub minor_version: U16<LE>,
pub typ: U32<LE>,
pub size_of_data: U32<LE>,
pub address_of_raw_data: U32<LE>,
pub pointer_to_raw_data: U32<LE>,
}
pub const IMAGE_DEBUG_TYPE_UNKNOWN: u32 = 0;
pub const IMAGE_DEBUG_TYPE_COFF: u32 = 1;
pub const IMAGE_DEBUG_TYPE_CODEVIEW: u32 = 2;
pub const IMAGE_DEBUG_TYPE_FPO: u32 = 3;
pub const IMAGE_DEBUG_TYPE_MISC: u32 = 4;
pub const IMAGE_DEBUG_TYPE_EXCEPTION: u32 = 5;
pub const IMAGE_DEBUG_TYPE_FIXUP: u32 = 6;
pub const IMAGE_DEBUG_TYPE_OMAP_TO_SRC: u32 = 7;
pub const IMAGE_DEBUG_TYPE_OMAP_FROM_SRC: u32 = 8;
pub const IMAGE_DEBUG_TYPE_BORLAND: u32 = 9;
pub const IMAGE_DEBUG_TYPE_RESERVED10: u32 = 10;
pub const IMAGE_DEBUG_TYPE_CLSID: u32 = 11;
pub const IMAGE_DEBUG_TYPE_VC_FEATURE: u32 = 12;
pub const IMAGE_DEBUG_TYPE_POGO: u32 = 13;
pub const IMAGE_DEBUG_TYPE_ILTCG: u32 = 14;
pub const IMAGE_DEBUG_TYPE_MPX: u32 = 15;
pub const IMAGE_DEBUG_TYPE_REPRO: u32 = 16;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageCoffSymbolsHeader {
pub number_of_symbols: U32<LE>,
pub lva_to_first_symbol: U32<LE>,
pub number_of_linenumbers: U32<LE>,
pub lva_to_first_linenumber: U32<LE>,
pub rva_to_first_byte_of_code: U32<LE>,
pub rva_to_last_byte_of_code: U32<LE>,
pub rva_to_first_byte_of_data: U32<LE>,
pub rva_to_last_byte_of_data: U32<LE>,
}
pub const FRAME_FPO: u16 = 0;
pub const FRAME_TRAP: u16 = 1;
pub const FRAME_TSS: u16 = 2;
pub const FRAME_NONFPO: u16 = 3;
pub const IMAGE_DEBUG_MISC_EXENAME: u16 = 1;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDebugMisc {
pub data_type: U32<LE>,
pub length: U32<LE>,
pub unicode: u8,
pub reserved: [u8; 3],
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageFunctionEntry {
pub starting_address: U32<LE>,
pub ending_address: U32<LE>,
pub end_of_prologue: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageFunctionEntry64 {
pub starting_address: U64<LE>,
pub ending_address: U64<LE>,
pub end_of_prologue_or_unwind_info_address: U64<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSeparateDebugHeader {
pub signature: U16<LE>,
pub flags: U16<LE>,
pub machine: U16<LE>,
pub characteristics: U16<LE>,
pub time_date_stamp: U32<LE>,
pub check_sum: U32<LE>,
pub image_base: U32<LE>,
pub size_of_image: U32<LE>,
pub number_of_sections: U32<LE>,
pub exported_names_size: U32<LE>,
pub debug_directory_size: U32<LE>,
pub section_alignment: U32<LE>,
pub reserved: [U32<LE>; 2],
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct NonPagedDebugInfo {
pub signature: U16<LE>,
pub flags: U16<LE>,
pub size: U32<LE>,
pub machine: U16<LE>,
pub characteristics: U16<LE>,
pub time_date_stamp: U32<LE>,
pub check_sum: U32<LE>,
pub size_of_image: U32<LE>,
pub image_base: U64<LE>,
}
pub const IMAGE_SEPARATE_DEBUG_SIGNATURE: u16 = 0x4944;
pub const NON_PAGED_DEBUG_SIGNATURE: u16 = 0x494E;
pub const IMAGE_SEPARATE_DEBUG_FLAGS_MASK: u16 = 0x8000;
pub const IMAGE_SEPARATE_DEBUG_MISMATCH: u16 = 0x8000;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageArchitectureEntry {
pub fixup_inst_rva: U32<LE>,
pub new_inst: U32<LE>,
}
pub const IMPORT_OBJECT_HDR_SIG2: u16 = 0xffff;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImportObjectHeader {
pub sig1: U16<LE>,
pub sig2: U16<LE>,
pub version: U16<LE>,
pub machine: U16<LE>,
pub time_date_stamp: U32<LE>,
pub size_of_data: U32<LE>,
pub ordinal_or_hint: U16<LE>,
pub name_type: U16<LE>,
}
pub const IMPORT_OBJECT_CODE: u16 = 0;
pub const IMPORT_OBJECT_DATA: u16 = 1;
pub const IMPORT_OBJECT_CONST: u16 = 2;
pub const IMPORT_OBJECT_ORDINAL: u16 = 0;
pub const IMPORT_OBJECT_NAME: u16 = 1;
pub const IMPORT_OBJECT_NAME_NO_PREFIX: u16 = 2;
pub const IMPORT_OBJECT_NAME_UNDECORATE: u16 = 3;
pub const IMPORT_OBJECT_NAME_EXPORTAS: u16 = 4;
pub const COMIMAGE_FLAGS_ILONLY: u32 = 0x0000_0001;
pub const COMIMAGE_FLAGS_32BITREQUIRED: u32 = 0x0000_0002;
pub const COMIMAGE_FLAGS_IL_LIBRARY: u32 = 0x0000_0004;
pub const COMIMAGE_FLAGS_STRONGNAMESIGNED: u32 = 0x0000_0008;
pub const COMIMAGE_FLAGS_NATIVE_ENTRYPOINT: u32 = 0x0000_0010;
pub const COMIMAGE_FLAGS_TRACKDEBUGDATA: u32 = 0x0001_0000;
pub const COMIMAGE_FLAGS_32BITPREFERRED: u32 = 0x0002_0000;
pub const COR_VERSION_MAJOR_V2: u16 = 2;
pub const COR_VERSION_MAJOR: u16 = COR_VERSION_MAJOR_V2;
pub const COR_VERSION_MINOR: u16 = 5;
pub const COR_DELETED_NAME_LENGTH: usize = 8;
pub const COR_VTABLEGAP_NAME_LENGTH: usize = 8;
pub const NATIVE_TYPE_MAX_CB: u16 = 1;
pub const COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE: u16 = 0xFF;
pub const IMAGE_COR_MIH_METHODRVA: u16 = 0x01;
pub const IMAGE_COR_MIH_EHRVA: u16 = 0x02;
pub const IMAGE_COR_MIH_BASICBLOCK: u16 = 0x08;
pub const COR_VTABLE_32BIT: u16 = 0x01;
pub const COR_VTABLE_64BIT: u16 = 0x02;
pub const COR_VTABLE_FROM_UNMANAGED: u16 = 0x04;
pub const COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN: u16 = 0x08;
pub const COR_VTABLE_CALL_MOST_DERIVED: u16 = 0x10;
pub const IMAGE_COR_EATJ_THUNK_SIZE: usize = 32;
pub const MAX_CLASS_NAME: usize = 1024;
pub const MAX_PACKAGE_NAME: usize = 1024;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageCor20Header {
pub cb: U32<LE>,
pub major_runtime_version: U16<LE>,
pub minor_runtime_version: U16<LE>,
pub meta_data: ImageDataDirectory,
pub flags: U32<LE>,
pub entry_point_token_or_rva: U32<LE>,
pub resources: ImageDataDirectory,
pub strong_name_signature: ImageDataDirectory,
pub code_manager_table: ImageDataDirectory,
pub vtable_fixups: ImageDataDirectory,
pub export_address_table_jumps: ImageDataDirectory,
pub managed_native_header: ImageDataDirectory,
}
unsafe_impl_pod!(
ImageDosHeader,
ImageOs2Header,
ImageVxdHeader,
ImageFileHeader,
ImageDataDirectory,
ImageOptionalHeader32,
ImageRomOptionalHeader,
ImageOptionalHeader64,
ImageNtHeaders64,
ImageNtHeaders32,
ImageRomHeaders,
Guid,
AnonObjectHeader,
AnonObjectHeaderV2,
AnonObjectHeaderBigobj,
ImageSectionHeader,
ImageSymbol,
ImageSymbolBytes,
ImageSymbolEx,
ImageSymbolExBytes,
ImageAuxSymbolTokenDef,
ImageAuxSymbolFunction,
ImageAuxSymbolFunctionBeginEnd,
ImageAuxSymbolWeak,
ImageAuxSymbolSection,
ImageAuxSymbolCrc,
ImageRelocation,
ImageLinenumber,
ImageBaseRelocation,
ImageArchiveMemberHeader,
ImageExportDirectory,
ImageImportByName,
ImageTlsDirectory64,
ImageTlsDirectory32,
ImageImportDescriptor,
ImageBoundImportDescriptor,
ImageBoundForwarderRef,
ImageDelayloadDescriptor,
ImageResourceDirectory,
ImageResourceDirectoryEntry,
ImageResourceDirectoryString,
ImageResourceDirStringU,
ImageResourceDataEntry,
ImageLoadConfigCodeIntegrity,
ImageDynamicRelocationTable,
ImageDynamicRelocation32,
ImageDynamicRelocation64,
ImageDynamicRelocation32V2,
ImageDynamicRelocation64V2,
ImagePrologueDynamicRelocationHeader,
ImageEpilogueDynamicRelocationHeader,
ImageLoadConfigDirectory32,
ImageLoadConfigDirectory64,
ImageHotPatchInfo,
ImageHotPatchBase,
ImageHotPatchHashes,
ImageArmRuntimeFunctionEntry,
ImageArm64RuntimeFunctionEntry,
ImageAlpha64RuntimeFunctionEntry,
ImageAlphaRuntimeFunctionEntry,
ImageRuntimeFunctionEntry,
ImageEnclaveConfig32,
ImageEnclaveConfig64,
ImageEnclaveImport,
ImageDebugDirectory,
ImageCoffSymbolsHeader,
ImageDebugMisc,
ImageFunctionEntry,
ImageFunctionEntry64,
ImageSeparateDebugHeader,
NonPagedDebugInfo,
ImageArchitectureEntry,
ImportObjectHeader,
ImageCor20Header,
);