1use crate::*;
2use winapi::shared::basetsd::{KAFFINITY, ULONG_PTR};
3use winapi::shared::minwindef::{BYTE, WORD};
4use winapi::shared::ntdef::GROUP_AFFINITY;
5use winapi::um::winnt::{PROCESSOR_NUMBER, EXCEPTION_RECORD, PVOID, EXCEPTION_MAXIMUM_PARAMETERS, EXCEPTION_POINTERS, CONTEXT};
6
7make_struct! {PROCESSOR_NUMBER,
8#[derive(Debug)]
9pub struct ProcessorNumber {
10 group_number: WORD,
11 number: BYTE,
12 reserved: BYTE,
13}}
14
15make_struct! {GROUP_AFFINITY,
16#[derive(Debug)]
17pub struct GroupAffinity {
18 mask: KAFFINITY,
19 group: WORD,
20 reserved: [WORD; 3],
21}}
22
23#[repr(u32)]
51#[allow(non_camel_case_types)]
52pub enum DllReason {
53 PROCESS_ATTACH = 1,
55 PROCESS_DETACH = 0,
57 THREAD_ATTACH = 2,
59 THREAD_DETACH = 3,
61}
62
63impl From<DWORD> for DllReason {
64 fn from(x: u32) -> Self {
65 match x {
66 1 => Self::PROCESS_ATTACH,
67 0 => Self::PROCESS_DETACH,
68 2 => Self::THREAD_ATTACH,
69 3 => Self::THREAD_DETACH,
70 e => panic!("Unknown DLL reason: {}", e)
71 }
72 }
73}
74
75make_struct! {EXCEPTION_POINTERS,
76pub struct ExceptionPointers<'a> {
77 pub exception_record:&'a mut ExceptionRecord<'a>,
78 pub context_record:&'a mut CONTEXT,
79}}
80
81make_struct! {EXCEPTION_RECORD,
82pub struct ExceptionRecord<'a>{
83 pub exception_code: DWORD,
84 pub exception_flags: DWORD,
85 pub exception_record: Option<&'a mut EXCEPTION_RECORD>,
86 pub exception_address: PVOID,
87 pub number_parameters: DWORD,
88 pub exception_information: [ULONG_PTR; EXCEPTION_MAXIMUM_PARAMETERS],
89}}