Skip to content

Commit

Permalink
Status: correctly use own module ID for status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
athre0z committed Feb 11, 2024
1 parent fa88475 commit 7188eeb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub type Result<T = ()> = result::Result<T, Status>;
pub const ZYAN_MODULE_ZYCORE: usize = 0x1;
pub const ZYAN_MODULE_ZYDIS: usize = 0x2;
pub const ZYAN_MODULE_USER: usize = 0x3FF;
pub const ZYAN_MODULE_ZYDIS_RS: usize = ZYAN_MODULE_USER + 0x42;

macro_rules! make_status {
($error:expr, $module:expr, $code:expr) => {
Expand Down Expand Up @@ -46,9 +47,12 @@ pub enum Status {
SkipToken = make_status!(0, ZYAN_MODULE_ZYDIS, 0x0B),
ImpossibleInstruction = make_status!(1, ZYAN_MODULE_ZYDIS, 0x0C),

User = make_status!(1, ZYAN_MODULE_USER, 0x00),
NotUTF8 = make_status!(1, ZYAN_MODULE_USER, 0x01),
FormatterError = make_status!(1, ZYAN_MODULE_USER, 0x02),
/// Generic user-defined error (e.g. for use in formatter hooks).
User = make_status!(1, ZYAN_MODULE_ZYDIS_RS, 0x00),
/// String isn't UTF8 encoded.
NotUTF8 = make_status!(1, ZYAN_MODULE_ZYDIS_RS, 0x01),
/// Rust formatter returned an error.
FormatterError = make_status!(1, ZYAN_MODULE_ZYDIS_RS, 0x02),
}

impl Status {
Expand Down

0 comments on commit 7188eeb

Please sign in to comment.