Skip to content

Commit

Permalink
fix: make CONTEXT_ALL cross-architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jul 10, 2022
1 parent cff4ef4 commit 70496bb
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,6 @@ ffi! {
pub const INVALID_HANDLE_VALUE: HANDLE = -1isize as HANDLE;
pub const MAX_MODULE_NAME32: usize = 255;
pub const MAX_PATH: usize = 260;
pub const CONTEXT_i386: u32 = 0x10000;
pub const CONTEXT_CONTROL: u32 = CONTEXT_i386 | 0x01; // SS:SP, CS:IP, FLAGS, B;
pub const CONTEXT_INTEGER: u32 = CONTEXT_i386 | 0x02; // AX, BX, CX, DX, SI, D;
pub const CONTEXT_SEGMENTS: u32 = CONTEXT_i386 | 0x04; // DS, ES, FS, G;
pub const CONTEXT_FLOATING_POINT: u32 = CONTEXT_i386 | 0x08; // 387 stat;
pub const CONTEXT_DEBUG_REGISTERS: u32 = CONTEXT_i386 | 0x10; // DB 0-3,6,;
pub const CONTEXT_EXTENDED_REGISTERS: u32 = CONTEXT_i386 | 0x20; // cpu specific extension;
pub const CONTEXT_ALL: u32 = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS;


pub type DWORD = u32;
pub type PDWORD = *mut u32;
Expand Down Expand Up @@ -575,6 +566,18 @@ ffi! {
pub RegisterArea: [u8; 80],
pub Spare0: DWORD,
}

pub const CONTEXT_i386: DWORD = 0x00010000;
pub const CONTEXT_i486: DWORD = 0x00010000;
pub const CONTEXT_CONTROL: DWORD = CONTEXT_i386 | 0x00000001;
pub const CONTEXT_INTEGER: DWORD = CONTEXT_i386 | 0x00000002;
pub const CONTEXT_SEGMENTS: DWORD = CONTEXT_i386 | 0x00000004;
pub const CONTEXT_FLOATING_POINT: DWORD = CONTEXT_i386 | 0x00000008;
pub const CONTEXT_DEBUG_REGISTERS: DWORD = CONTEXT_i386 | 0x00000010;
pub const CONTEXT_EXTENDED_REGISTERS: DWORD = CONTEXT_i386 | 0x00000020;
pub const CONTEXT_FULL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS;
pub const CONTEXT_ALL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS
| CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS;
}

#[cfg(target_arch = "x86_64")]
Expand Down Expand Up @@ -642,6 +645,16 @@ ffi! {
pub Low: u64,
pub High: i64,
}

pub const CONTEXT_AMD64: DWORD = 0x00100000;
pub const CONTEXT_CONTROL: DWORD = CONTEXT_AMD64 | 0x00000001;
pub const CONTEXT_INTEGER: DWORD = CONTEXT_AMD64 | 0x00000002;
pub const CONTEXT_SEGMENTS: DWORD = CONTEXT_AMD64 | 0x00000004;
pub const CONTEXT_FLOATING_POINT: DWORD = CONTEXT_AMD64 | 0x00000008;
pub const CONTEXT_DEBUG_REGISTERS: DWORD = CONTEXT_AMD64 | 0x00000010;
pub const CONTEXT_FULL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT;
pub const CONTEXT_ALL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS
| CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS;
}

#[repr(C)]
Expand Down

0 comments on commit 70496bb

Please sign in to comment.