#![allow(unused, non_upper_case_globals, non_camel_case_types)]
use std::fmt;
use scroll::{ctx::TryFromCtx, Endian};
pub const S_COMPILE: u16 = 0x0001; pub const S_REGISTER_16t: u16 = 0x0002; pub const S_CONSTANT_16t: u16 = 0x0003; pub const S_UDT_16t: u16 = 0x0004; pub const S_SSEARCH: u16 = 0x0005; pub const S_END: u16 = 0x0006; pub const S_SKIP: u16 = 0x0007; pub const S_CVRESERVE: u16 = 0x0008; pub const S_OBJNAME_ST: u16 = 0x0009; pub const S_ENDARG: u16 = 0x000a; pub const S_COBOLUDT_16t: u16 = 0x000b; pub const S_MANYREG_16t: u16 = 0x000c; pub const S_RETURN: u16 = 0x000d; pub const S_ENTRYTHIS: u16 = 0x000e; pub const S_BPREL16: u16 = 0x0100; pub const S_LDATA16: u16 = 0x0101; pub const S_GDATA16: u16 = 0x0102; pub const S_PUB16: u16 = 0x0103; pub const S_LPROC16: u16 = 0x0104; pub const S_GPROC16: u16 = 0x0105; pub const S_THUNK16: u16 = 0x0106; pub const S_BLOCK16: u16 = 0x0107; pub const S_WITH16: u16 = 0x0108; pub const S_LABEL16: u16 = 0x0109; pub const S_CEXMODEL16: u16 = 0x010a; pub const S_VFTABLE16: u16 = 0x010b; pub const S_REGREL16: u16 = 0x010c; pub const S_BPREL32_16t: u16 = 0x0200; pub const S_LDATA32_16t: u16 = 0x0201; pub const S_GDATA32_16t: u16 = 0x0202; pub const S_PUB32_16t: u16 = 0x0203; pub const S_LPROC32_16t: u16 = 0x0204; pub const S_GPROC32_16t: u16 = 0x0205; pub const S_THUNK32_ST: u16 = 0x0206; pub const S_BLOCK32_ST: u16 = 0x0207; pub const S_WITH32_ST: u16 = 0x0208; pub const S_LABEL32_ST: u16 = 0x0209; pub const S_CEXMODEL32: u16 = 0x020a; pub const S_VFTABLE32_16t: u16 = 0x020b; pub const S_REGREL32_16t: u16 = 0x020c; pub const S_LTHREAD32_16t: u16 = 0x020d; pub const S_GTHREAD32_16t: u16 = 0x020e; pub const S_SLINK32: u16 = 0x020f; pub const S_LPROCMIPS_16t: u16 = 0x0300; pub const S_GPROCMIPS_16t: u16 = 0x0301; pub const S_PROCREF_ST: u16 = 0x0400; pub const S_DATAREF_ST: u16 = 0x0401; pub const S_ALIGN: u16 = 0x0402; pub const S_LPROCREF_ST: u16 = 0x0403; pub const S_OEM: u16 = 0x0404; pub const S_TI16_MAX: u16 = 0x1000;
pub const S_REGISTER_ST: u16 = 0x1001; pub const S_CONSTANT_ST: u16 = 0x1002; pub const S_UDT_ST: u16 = 0x1003; pub const S_COBOLUDT_ST: u16 = 0x1004; pub const S_MANYREG_ST: u16 = 0x1005; pub const S_BPREL32_ST: u16 = 0x1006; pub const S_LDATA32_ST: u16 = 0x1007; pub const S_GDATA32_ST: u16 = 0x1008; pub const S_PUB32_ST: u16 = 0x1009; pub const S_LPROC32_ST: u16 = 0x100a; pub const S_GPROC32_ST: u16 = 0x100b; pub const S_VFTABLE32: u16 = 0x100c; pub const S_REGREL32_ST: u16 = 0x100d; pub const S_LTHREAD32_ST: u16 = 0x100e; pub const S_GTHREAD32_ST: u16 = 0x100f; pub const S_LPROCMIPS_ST: u16 = 0x1010; pub const S_GPROCMIPS_ST: u16 = 0x1011; pub const S_FRAMEPROC: u16 = 0x1012; pub const S_COMPILE2_ST: u16 = 0x1013; pub const S_MANYREG2_ST: u16 = 0x1014; pub const S_LPROCIA64_ST: u16 = 0x1015; pub const S_GPROCIA64_ST: u16 = 0x1016; pub const S_LOCALSLOT_ST: u16 = 0x1017; pub const S_PARAMSLOT_ST: u16 = 0x1018; pub const S_ANNOTATION: u16 = 0x1019; pub const S_GMANPROC_ST: u16 = 0x101a; pub const S_LMANPROC_ST: u16 = 0x101b; pub const S_RESERVED1: u16 = 0x101c; pub const S_RESERVED2: u16 = 0x101d; pub const S_RESERVED3: u16 = 0x101e; pub const S_RESERVED4: u16 = 0x101f; pub const S_LMANDATA_ST: u16 = 0x1020;
pub const S_GMANDATA_ST: u16 = 0x1021;
pub const S_MANFRAMEREL_ST: u16 = 0x1022;
pub const S_MANREGISTER_ST: u16 = 0x1023;
pub const S_MANSLOT_ST: u16 = 0x1024;
pub const S_MANMANYREG_ST: u16 = 0x1025;
pub const S_MANREGREL_ST: u16 = 0x1026;
pub const S_MANMANYREG2_ST: u16 = 0x1027;
pub const S_MANTYPREF: u16 = 0x1028; pub const S_UNAMESPACE_ST: u16 = 0x1029; pub const S_ST_MAX: u16 = 0x1100; pub const S_OBJNAME: u16 = 0x1101; pub const S_THUNK32: u16 = 0x1102; pub const S_BLOCK32: u16 = 0x1103; pub const S_WITH32: u16 = 0x1104; pub const S_LABEL32: u16 = 0x1105; pub const S_REGISTER: u16 = 0x1106; pub const S_CONSTANT: u16 = 0x1107; pub const S_UDT: u16 = 0x1108; pub const S_COBOLUDT: u16 = 0x1109; pub const S_MANYREG: u16 = 0x110a; pub const S_BPREL32: u16 = 0x110b; pub const S_LDATA32: u16 = 0x110c; pub const S_GDATA32: u16 = 0x110d; pub const S_PUB32: u16 = 0x110e; pub const S_LPROC32: u16 = 0x110f; pub const S_GPROC32: u16 = 0x1110; pub const S_REGREL32: u16 = 0x1111; pub const S_LTHREAD32: u16 = 0x1112; pub const S_GTHREAD32: u16 = 0x1113; pub const S_LPROCMIPS: u16 = 0x1114; pub const S_GPROCMIPS: u16 = 0x1115; pub const S_COMPILE2: u16 = 0x1116; pub const S_MANYREG2: u16 = 0x1117; pub const S_LPROCIA64: u16 = 0x1118; pub const S_GPROCIA64: u16 = 0x1119; pub const S_LOCALSLOT: u16 = 0x111a; pub const S_PARAMSLOT: u16 = 0x111b; pub const S_LMANDATA: u16 = 0x111c;
pub const S_GMANDATA: u16 = 0x111d;
pub const S_MANFRAMEREL: u16 = 0x111e;
pub const S_MANREGISTER: u16 = 0x111f;
pub const S_MANSLOT: u16 = 0x1120;
pub const S_MANMANYREG: u16 = 0x1121;
pub const S_MANREGREL: u16 = 0x1122;
pub const S_MANMANYREG2: u16 = 0x1123;
pub const S_UNAMESPACE: u16 = 0x1124; pub const S_PROCREF: u16 = 0x1125; pub const S_DATAREF: u16 = 0x1126; pub const S_LPROCREF: u16 = 0x1127; pub const S_ANNOTATIONREF: u16 = 0x1128; pub const S_TOKENREF: u16 = 0x1129; pub const S_GMANPROC: u16 = 0x112a; pub const S_LMANPROC: u16 = 0x112b; pub const S_TRAMPOLINE: u16 = 0x112c; pub const S_MANCONSTANT: u16 = 0x112d; pub const S_ATTR_FRAMEREL: u16 = 0x112e; pub const S_ATTR_REGISTER: u16 = 0x112f; pub const S_ATTR_REGREL: u16 = 0x1130; pub const S_ATTR_MANYREG: u16 = 0x1131; pub const S_SEPCODE: u16 = 0x1132;
pub const S_LOCAL_2005: u16 = 0x1133; pub const S_DEFRANGE_2005: u16 = 0x1134; pub const S_DEFRANGE2_2005: u16 = 0x1135; pub const S_SECTION: u16 = 0x1136; pub const S_COFFGROUP: u16 = 0x1137; pub const S_EXPORT: u16 = 0x1138; pub const S_CALLSITEINFO: u16 = 0x1139; pub const S_FRAMECOOKIE: u16 = 0x113a; pub const S_DISCARDED: u16 = 0x113b; pub const S_COMPILE3: u16 = 0x113c; pub const S_ENVBLOCK: u16 = 0x113d; pub const S_LOCAL: u16 = 0x113e; pub const S_DEFRANGE: u16 = 0x113f; pub const S_DEFRANGE_SUBFIELD: u16 = 0x1140; pub const S_DEFRANGE_REGISTER: u16 = 0x1141; pub const S_DEFRANGE_FRAMEPOINTER_REL: u16 = 0x1142; pub const S_DEFRANGE_SUBFIELD_REGISTER: u16 = 0x1143; pub const S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE: u16 = 0x1144; pub const S_DEFRANGE_REGISTER_REL: u16 = 0x1145; pub const S_LPROC32_ID: u16 = 0x1146;
pub const S_GPROC32_ID: u16 = 0x1147;
pub const S_LPROCMIPS_ID: u16 = 0x1148;
pub const S_GPROCMIPS_ID: u16 = 0x1149;
pub const S_LPROCIA64_ID: u16 = 0x114a;
pub const S_GPROCIA64_ID: u16 = 0x114b;
pub const S_BUILDINFO: u16 = 0x114c; pub const S_INLINESITE: u16 = 0x114d; pub const S_INLINESITE_END: u16 = 0x114e;
pub const S_PROC_ID_END: u16 = 0x114f;
pub const S_DEFRANGE_HLSL: u16 = 0x1150;
pub const S_GDATA_HLSL: u16 = 0x1151;
pub const S_LDATA_HLSL: u16 = 0x1152;
pub const S_FILESTATIC: u16 = 0x1153;
pub const S_LOCAL_DPC_GROUPSHARED: u16 = 0x1154; pub const S_LPROC32_DPC: u16 = 0x1155; pub const S_LPROC32_DPC_ID: u16 = 0x1156;
pub const S_DEFRANGE_DPC_PTR_TAG: u16 = 0x1157; pub const S_DPC_SYM_TAG_MAP: u16 = 0x1158; pub const S_ARMSWITCHTABLE: u16 = 0x1159;
pub const S_CALLEES: u16 = 0x115a;
pub const S_CALLERS: u16 = 0x115b;
pub const S_POGODATA: u16 = 0x115c;
pub const S_INLINESITE2: u16 = 0x115d; pub const S_HEAPALLOCSITE: u16 = 0x115e; pub const S_MOD_TYPEREF: u16 = 0x115f; pub const S_REF_MINIPDB: u16 = 0x1160; pub const S_PDBMAP: u16 = 0x1161; pub const S_GDATA_HLSL32: u16 = 0x1162;
pub const S_LDATA_HLSL32: u16 = 0x1163;
pub const S_GDATA_HLSL32_EX: u16 = 0x1164;
pub const S_LDATA_HLSL32_EX: u16 = 0x1165;
pub const S_FASTLINK: u16 = 0x1167; pub const S_INLINEES: u16 = 0x1168;
#[non_exhaustive]
#[allow(missing_docs)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum CPUType {
Intel8080 = 0x0,
Intel8086 = 0x1,
Intel80286 = 0x2,
Intel80386 = 0x3,
Intel80486 = 0x4,
Pentium = 0x5,
PentiumPro = 0x6,
Pentium3 = 0x7,
MIPS = 0x10,
MIPS16 = 0x11,
MIPS32 = 0x12,
MIPS64 = 0x13,
MIPSI = 0x14,
MIPSII = 0x15,
MIPSIII = 0x16,
MIPSIV = 0x17,
MIPSV = 0x18,
M68000 = 0x20,
M68010 = 0x21,
M68020 = 0x22,
M68030 = 0x23,
M68040 = 0x24,
Alpha = 0x30,
Alpha21164 = 0x31,
Alpha21164A = 0x32,
Alpha21264 = 0x33,
Alpha21364 = 0x34,
PPC601 = 0x40,
PPC603 = 0x41,
PPC604 = 0x42,
PPC620 = 0x43,
PPCFP = 0x44,
PPCBE = 0x45,
SH3 = 0x50,
SH3E = 0x51,
SH3DSP = 0x52,
SH4 = 0x53,
SHMedia = 0x54,
ARM3 = 0x60,
ARM4 = 0x61,
ARM4T = 0x62,
ARM5 = 0x63,
ARM5T = 0x64,
ARM6 = 0x65,
ARM_XMAC = 0x66,
ARM_WMMX = 0x67,
ARM7 = 0x68,
ARM64 = 0x69,
Omni = 0x70,
Ia64 = 0x80,
Ia64_2 = 0x81,
CEE = 0x90,
AM33 = 0xa0,
M32R = 0xb0,
TriCore = 0xc0,
X64 = 0xd0,
EBC = 0xe0,
Thumb = 0xf0,
ARMNT = 0xf4,
D3D11_Shader = 0x100,
}
impl fmt::Display for CPUType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Intel8080 => write!(f, "Intel8080"),
Self::Intel8086 => write!(f, "Intel8086"),
Self::Intel80286 => write!(f, "Intel80286"),
Self::Intel80386 => write!(f, "Intel80386"),
Self::Intel80486 => write!(f, "Intel80486"),
Self::Pentium => write!(f, "Pentium"),
Self::PentiumPro => write!(f, "PentiumPro"),
Self::Pentium3 => write!(f, "Pentium3"),
Self::MIPS => write!(f, "MIPS"),
Self::MIPS16 => write!(f, "MIPS16"),
Self::MIPS32 => write!(f, "MIPS32"),
Self::MIPS64 => write!(f, "MIPS64"),
Self::MIPSI => write!(f, "MIPSI"),
Self::MIPSII => write!(f, "MIPSII"),
Self::MIPSIII => write!(f, "MIPSIII"),
Self::MIPSIV => write!(f, "MIPSIV"),
Self::MIPSV => write!(f, "MIPSV"),
Self::M68000 => write!(f, "M68000"),
Self::M68010 => write!(f, "M68010"),
Self::M68020 => write!(f, "M68020"),
Self::M68030 => write!(f, "M68030"),
Self::M68040 => write!(f, "M68040"),
Self::Alpha => write!(f, "Alpha"),
Self::Alpha21164 => write!(f, "Alpha21164"),
Self::Alpha21164A => write!(f, "Alpha21164A"),
Self::Alpha21264 => write!(f, "Alpha21264"),
Self::Alpha21364 => write!(f, "Alpha21364"),
Self::PPC601 => write!(f, "PPC601"),
Self::PPC603 => write!(f, "PPC603"),
Self::PPC604 => write!(f, "PPC604"),
Self::PPC620 => write!(f, "PPC620"),
Self::PPCFP => write!(f, "PPCFP"),
Self::PPCBE => write!(f, "PPCBE"),
Self::SH3 => write!(f, "SH3"),
Self::SH3E => write!(f, "SH3E"),
Self::SH3DSP => write!(f, "SH3DSP"),
Self::SH4 => write!(f, "SH4"),
Self::SHMedia => write!(f, "SHMedia"),
Self::ARM3 => write!(f, "ARM3"),
Self::ARM4 => write!(f, "ARM4"),
Self::ARM4T => write!(f, "ARM4T"),
Self::ARM5 => write!(f, "ARM5"),
Self::ARM5T => write!(f, "ARM5T"),
Self::ARM6 => write!(f, "ARM6"),
Self::ARM_XMAC => write!(f, "ARM_XMAC"),
Self::ARM_WMMX => write!(f, "ARM_WMMX"),
Self::ARM7 => write!(f, "ARM7"),
Self::ARM64 => write!(f, "ARM64"),
Self::Omni => write!(f, "Omni"),
Self::Ia64 => write!(f, "Ia64"),
Self::Ia64_2 => write!(f, "Ia64_2"),
Self::CEE => write!(f, "CEE"),
Self::AM33 => write!(f, "AM33"),
Self::M32R => write!(f, "M32R"),
Self::TriCore => write!(f, "TriCore"),
Self::X64 => write!(f, "X64"),
Self::EBC => write!(f, "EBC"),
Self::Thumb => write!(f, "Thumb"),
Self::ARMNT => write!(f, "ARMNT"),
Self::D3D11_Shader => write!(f, "D3D11_Shader"),
}
}
}
impl From<u16> for CPUType {
fn from(value: u16) -> Self {
match value {
0x0 => Self::Intel8080,
0x1 => Self::Intel8086,
0x2 => Self::Intel80286,
0x3 => Self::Intel80386,
0x4 => Self::Intel80486,
0x5 => Self::Pentium,
0x6 => Self::PentiumPro,
0x7 => Self::Pentium3,
0x10 => Self::MIPS,
0x11 => Self::MIPS16,
0x12 => Self::MIPS32,
0x13 => Self::MIPS64,
0x14 => Self::MIPSI,
0x15 => Self::MIPSII,
0x16 => Self::MIPSIII,
0x17 => Self::MIPSIV,
0x18 => Self::MIPSV,
0x20 => Self::M68000,
0x21 => Self::M68010,
0x22 => Self::M68020,
0x23 => Self::M68030,
0x24 => Self::M68040,
0x30 => Self::Alpha,
0x31 => Self::Alpha21164,
0x32 => Self::Alpha21164A,
0x33 => Self::Alpha21264,
0x34 => Self::Alpha21364,
0x40 => Self::PPC601,
0x41 => Self::PPC603,
0x42 => Self::PPC604,
0x43 => Self::PPC620,
0x44 => Self::PPCFP,
0x45 => Self::PPCBE,
0x50 => Self::SH3,
0x51 => Self::SH3E,
0x52 => Self::SH3DSP,
0x53 => Self::SH4,
0x54 => Self::SHMedia,
0x60 => Self::ARM3,
0x61 => Self::ARM4,
0x62 => Self::ARM4T,
0x63 => Self::ARM5,
0x64 => Self::ARM5T,
0x65 => Self::ARM6,
0x66 => Self::ARM_XMAC,
0x67 => Self::ARM_WMMX,
0x68 => Self::ARM7,
0x69 => Self::ARM64,
0x70 => Self::Omni,
0x80 => Self::Ia64,
0x81 => Self::Ia64_2,
0x90 => Self::CEE,
0xa0 => Self::AM33,
0xb0 => Self::M32R,
0xc0 => Self::TriCore,
0xd0 => Self::X64,
0xe0 => Self::EBC,
0xf0 => Self::Thumb,
0xf4 => Self::ARMNT,
0x100 => Self::D3D11_Shader,
_ => Self::Intel8080, }
}
}
impl<'a> TryFromCtx<'a, Endian> for CPUType {
type Error = scroll::Error;
fn try_from_ctx(this: &'a [u8], le: Endian) -> scroll::Result<(Self, usize)> {
u16::try_from_ctx(this, le).map(|(v, l)| (v.into(), l))
}
}
#[non_exhaustive]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum SourceLanguage {
C = 0x00,
Cpp = 0x01,
Fortran = 0x02,
Masm = 0x03,
Pascal = 0x04,
Basic = 0x05,
Cobol = 0x06,
Link = 0x07,
Cvtres = 0x08,
Cvtpgd = 0x09,
CSharp = 0x0a,
VB = 0x0b,
ILAsm = 0x0c,
Java = 0x0d,
JScript = 0x0e,
MSIL = 0x0f,
HLSL = 0x10,
D = 0x44,
}
impl fmt::Display for SourceLanguage {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::C => write!(f, "C"),
Self::Cpp => write!(f, "Cpp"),
Self::Fortran => write!(f, "Fortran"),
Self::Masm => write!(f, "Masm"),
Self::Pascal => write!(f, "Pascal"),
Self::Basic => write!(f, "Basic"),
Self::Cobol => write!(f, "Cobol"),
Self::Link => write!(f, "Link"),
Self::Cvtres => write!(f, "Cvtres"),
Self::Cvtpgd => write!(f, "Cvtpgd"),
Self::CSharp => write!(f, "CSharp"),
Self::VB => write!(f, "VB"),
Self::ILAsm => write!(f, "ILAsm"),
Self::Java => write!(f, "Java"),
Self::JScript => write!(f, "JScript"),
Self::MSIL => write!(f, "MSIL"),
Self::HLSL => write!(f, "HLSL"),
Self::D => write!(f, "D"),
}
}
}
impl From<u8> for SourceLanguage {
fn from(value: u8) -> Self {
match value {
0x00 => Self::C,
0x01 => Self::Cpp,
0x02 => Self::Fortran,
0x03 => Self::Masm,
0x04 => Self::Pascal,
0x05 => Self::Basic,
0x06 => Self::Cobol,
0x07 => Self::Link,
0x08 => Self::Cvtres,
0x09 => Self::Cvtpgd,
0x0a => Self::CSharp,
0x0b => Self::VB,
0x0c => Self::ILAsm,
0x0d => Self::Java,
0x0e => Self::JScript,
0x0f => Self::MSIL,
0x10 => Self::HLSL,
0x44 => Self::D,
_ => Self::Masm, }
}
}
impl<'a> TryFromCtx<'a, Endian> for SourceLanguage {
type Error = scroll::Error;
fn try_from_ctx(this: &'a [u8], le: Endian) -> scroll::Result<(Self, usize)> {
u8::try_from_ctx(this, le).map(|(v, l)| (v.into(), l))
}
}