pub enum HaoError {
Show 27 variants
IoError(Error),
BadPeFormat,
PeError(PewterError),
NotDotNetBinary,
BadImageFormat(&'static str),
BadRva(u32),
NotEnoughDataLeft(usize),
InvalidColumnSize(i32),
InvalidCodedToken(u32, &'static str),
InvalidCodedTokenOffset(u32, &'static str),
InvalidStreamIndex(&'static str, usize),
InvalidUTF8String(usize, Vec<u8>),
InvalidSignatureCallingConvention(u8),
InvalidSignatureElementType(u8, usize),
InvalidSignature(&'static str, usize),
InvalidMethodBody(&'static str, usize),
InvalidOpCode(u16, usize),
InvalidToken(u32),
InvalidCustomAttribute(String),
ValueTooLarge(&'static str),
WriteError(String),
Import(String),
NotFound(String),
InvalidSignatureForEntry(&'static str),
RecursionLimitReached,
InvalidEntryReference(&'static str, usize),
Unknown,
}Expand description
Everything that can go wrong reading, editing or writing a module.
Loading is strict, so most variants describe a malformed image: which part of the file was bad and, where known, where.
Variants§
IoError(Error)
Reading or writing the file on disk failed, in Module::from_path
or Module::write_to_path.
BadPeFormat
The bytes are not a valid PE image, or its optional header is missing.
PeError(PewterError)
The PE image could not be re-parsed or written back while writing a module.
NotDotNetBinary
The PE image has no CLI header, so it is native code rather than a .NET assembly.
BadImageFormat(&'static str)
The CLI header or metadata is malformed; the message says what was wrong.
BadRva(u32)
A relative virtual address points outside every section of the image.
NotEnoughDataLeft(usize)
A read ran past the end of its buffer; holds how many bytes were missing.
InvalidColumnSize(i32)
A metadata table column has an impossible size. Currently never returned.
InvalidCodedToken(u32, &'static str)
A coded index (e.g. TypeDefOrRef) has a tag that names no table; holds the
raw value and the coded index kind.
InvalidCodedTokenOffset(u32, &'static str)
A coded index points past the end of its table. Currently never returned.
InvalidStreamIndex(&'static str, usize)
An offset into a metadata heap (#Strings, #Blob, #GUID, #US) is out of range.
InvalidUTF8String(usize, Vec<u8>)
A #Strings heap entry is not valid UTF-8; holds its offset and raw bytes.
InvalidSignatureCallingConvention(u8)
A signature starts with a calling convention byte hao does not recognise.
InvalidSignatureElementType(u8, usize)
A signature contains an unknown or misplaced ELEMENT_TYPE_* byte.
InvalidSignature(&'static str, usize)
A signature blob is malformed in some other way (truncated, a null token, …).
InvalidMethodBody(&'static str, usize)
A method body header, exception clause or operand is malformed.
InvalidOpCode(u16, usize)
The IL stream contains a byte sequence that is not an opcode.
InvalidToken(u32)
A metadata token in IL or a signature names a table it can’t, or a row that doesn’t exist.
InvalidCustomAttribute(String)
A custom attribute blob could not be decoded or encoded.
ValueTooLarge(&'static str)
A value is too big for its encoding, e.g. an integer over the compressed-integer limit.
WriteError(String)
A module could not be written: e.g. a branch to a missing label, or an entry that belongs to another module.
Import(String)
Something couldn’t be imported into a module (a type, method or field from another module, say).
NotFound(String)
A lookup found nothing: a type, member or assembly.
InvalidSignatureForEntry(&'static str)
A signature is the wrong kind for its entry. Currently never returned.
RecursionLimitReached
A signature nests types too deeply (more than 64 levels), which usually means it is malformed or cyclic.
InvalidEntryReference(&'static str, usize)
A table row refers to a row of another table that doesn’t exist; holds the table name and index.
Unknown
Unspecified failure. Currently never returned.
Trait Implementations§
Source§impl Error for HaoError
impl Error for HaoError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()