mirror of
https://github.com/joaoviictorti/shadow-rs.git
synced 2025-12-19 00:04:19 +01:00
93 lines
3.3 KiB
Rust
93 lines
3.3 KiB
Rust
use alloc::string::String;
|
|
use thiserror::Error;
|
|
|
|
pub type ShadowResult<T> = core::result::Result<T, ShadowError>;
|
|
|
|
#[derive(Debug, Error)]
|
|
pub enum ShadowError {
|
|
/// Represents an error where an API call failed.
|
|
#[error("{0} Failed With Status: {1}")]
|
|
ApiCallFailed(&'static str, i32),
|
|
|
|
/// Represents an error where a function execution failed at a specific line.
|
|
#[error("{0} function failed on the line: {1}")]
|
|
FunctionExecutionFailed(&'static str, u32),
|
|
|
|
/// Represents an error when an invalid memory access occurs.
|
|
#[error("Invalid memory access at address")]
|
|
InvalidMemory,
|
|
|
|
/// Error when a process with a specific identifier is not found.
|
|
#[error("Process with identifier {0} not found")]
|
|
ProcessNotFound(String),
|
|
|
|
/// Error when a thread with a specific TID is not found.
|
|
#[error("Thread with TID {0} not found")]
|
|
ThreadNotFound(usize),
|
|
|
|
/// Represents an invalid device request error.
|
|
#[error("Invalid Device Request")]
|
|
InvalidDeviceRequest,
|
|
|
|
/// Represents an error where a null pointer was encountered.
|
|
#[error("Pointer is null: {0}")]
|
|
NullPointer(&'static str),
|
|
|
|
/// Represents an error where a string conversion from a raw pointer failed.
|
|
#[error("Failed to convert string from raw pointer at {0}")]
|
|
StringConversionFailed(usize),
|
|
|
|
/// Represents an error where a specific module was not found.
|
|
#[error("Module {0} not found")]
|
|
ModuleNotFound(String),
|
|
|
|
/// Represents an error where a driver with a specific name was not found.
|
|
#[error("Driver {0} not found")]
|
|
DriverNotFound(String),
|
|
|
|
/// Represents an error where a pattern scan failed to locate a required pattern in memory.
|
|
#[error("Pattern not found")]
|
|
PatternNotFound,
|
|
|
|
/// Represents an error where a function could not be found in the specified module.
|
|
#[error("Function {0} not found in module")]
|
|
FunctionNotFound(String),
|
|
|
|
/// Represents an unknown failure in the system.
|
|
#[error("Unknown failure in {0}, at line {1}")]
|
|
UnknownFailure(&'static str, u32),
|
|
|
|
/// Represents an error when installing or uninstalling a hook on the Nsiproxy driver.
|
|
#[error("Error handling hook on Nsiproxy driver")]
|
|
HookFailure,
|
|
|
|
/// Represents an error when a buffer is too small to complete an operation.
|
|
#[error("Small buffer")]
|
|
BufferTooSmall,
|
|
|
|
/// Represents an error when a buffer is misaligned for the expected data structure.
|
|
#[error("Misaligned buffer")]
|
|
MisalignedBuffer,
|
|
|
|
/// Error indicating that a callback could not be found.
|
|
#[error("Error searching for the callback")]
|
|
CallbackNotFound,
|
|
|
|
/// Error indicating that a target with a specific index was not found.
|
|
#[error("Target not found with index: {0}")]
|
|
IndexNotFound(usize),
|
|
|
|
/// Error indicating that a failure occurred while removing a callback.
|
|
#[error("Error removing a callback")]
|
|
RemoveFailureCallback,
|
|
|
|
/// Represents an error when the process's active list entry is invalid,
|
|
/// such as when both the forward and backward pointers are null.
|
|
#[error("Invalid list entry encountered")]
|
|
InvalidListEntry,
|
|
|
|
/// Error indicating that a failure occurred while restoring a callback.
|
|
#[error("Error restoring a callback")]
|
|
RestoringFailureCallback,
|
|
}
|