Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error { ModuleNotFound { reason: &'static str, os_error: u32, }, ImageSizeUnknown { base: usize, os_error: u32, }, Malformed(&'static str), Unsupported(&'static str), SymbolNotFound { module: String, symbol: String, }, OriginalUnresolved { module: String, library: String, symbol: String, }, AuthenticatedSlot { module: String, symbol: String, }, Protect { slot: usize, os_error: u32, }, RestoreConflict { slot: usize, expected: usize, found: usize, }, }
Expand description

Errors produced by the engine while acquiring, parsing, or patching a module.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ModuleNotFound

A requested module could not be located in the current process (GetModuleHandleExW failed, or a null handle was supplied).

Fields

§reason: &'static str

What was being resolved (a handle, an address, or a name).

§os_error: u32

GetLastError() captured at the failure site.

§

ImageSizeUnknown

The loader reported no valid mapped size for the module, so no bounded range exists to parse against.

Fields

§base: usize

Module base address (HMODULE).

§os_error: u32

GetLastError() captured at the failure site.

§

Malformed(&'static str)

A structural defect was found while parsing the mapped image (PE or ELF). The parser bounds-checks every field against the validated mapped range before dereferencing, so a malformed image yields this error rather than

§

Unsupported(&'static str)

The image is a valid PE/ELF the engine intentionally does not handle at runtime (e.g. a 32-bit PE32 image inside a 64-bit process, a legacy absolute-VA delay-import descriptor, or an ELF machine that is not EM_X86_64/EM_AARCH64). Reported rather than guessed.

§

SymbolNotFound

A Replacement marked required matched no import slot in the module.

Fields

§module: String

Module name the lookup ran against.

§symbol: String

The symbol that was requested but not imported.

§

OriginalUnresolved

A matched import’s canonical original entry point could not be resolved, so passing through to it is impossible. This arises for a delay-load import whose providing DLL cannot be loaded (or whose symbol is absent from it): the delay IAT slot holds only the __delayLoadHelper2 stub until first call, and the engine refuses to hand a stub out as the original (calling it would resolve the import and overwrite the very slot we patched, silently dropping the hook). Reported for a required replacement; an optional one skips the slot instead.

Fields

§module: String

Module whose import was being hooked.

§library: String

Providing (delay-load) library that could not be resolved.

§symbol: String

The symbol whose original could not be resolved.

§

AuthenticatedSlot

A matched import slot holds an authenticated (PAC-signed) pointer — an it would require a replacement signed with the slot’s key, diversity, and address-discrimination, which cannot be synthesized here; the engine refuses the slot rather than write a pointer that fails its AUT* check (or is dereferenced unsigned). arm64e support is a dedicated, device-tested effort; plain arm64 and x86-64 slots are never authenticated and are unaffected.

Fields

§module: String

Module whose authenticated import was matched.

§symbol: String

The symbol whose slot is authenticated.

§

Protect

Changing a slot page’s protection failed. Carries the slot address and the OS error. When this happens mid-install the engine rolls back every

Fields

§slot: usize

Address of the import slot whose page could not be reprotected.

§os_error: u32

GetLastError() from the failing VirtualProtect call.

§

RestoreConflict

During restore, a slot no longer held this guard’s replacement pointer, untouched and reports the conflict instead (compare-exchange restore,

Fields

§slot: usize

Address of the conflicted import slot.

§expected: usize

The replacement pointer this guard installed and expected to find.

§found: usize

The pointer actually present in the slot.

Trait Implementations§

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.