use std::fmt;
use winapi::shared::ntdef::NTSTATUS;
pub enum SpfError {
RaisePrivilege(NTSTATUS),
QueryRanges(NTSTATUS),
QueryPfn(NTSTATUS),
Layout,
Translate,
Allocation
}
impl fmt::Display for SpfError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
SpfError::RaisePrivilege(s) => write!(f, "Can't raise privilege: {:#x}", s),
SpfError::QueryPfn(s) => write!(f, "Can't query page frame numbers: {:#x}", s),
SpfError::QueryRanges(s) => write!(f, "Can't query memory ranges: {:#x}", s),
SpfError::Translate => write!(f, "Unable to translate VA to PA"),
SpfError::Allocation => write!(f, "Unable allocate memory"),
SpfError::Layout => write!(f, "Unable to form a correct layout")
}
}
}