-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathintvect.cpp
82 lines (62 loc) · 1.06 KB
/
intvect.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*++
This is the part of NGdbg kernel debugger
intvect.cpp
Contains routines that work with APIC and IDT
--*/
#include <ntifs.h>
//
// IDT entry
//
#pragma pack(push, 1)
struct IDTEntry
{
USHORT OffsetLow;
USHORT Selector;
UCHAR ReservedByte;
UCHAR Type : 3;
UCHAR D : 1;
UCHAR UnusedBits2 : 1;
UCHAR DPL : 2;
UCHAR Present : 1;
USHORT OffsetHigh;
};
#pragma pack(pop)
//
// IDTR structure
//
#pragma pack(push, 2)
struct IDTR
{
USHORT Limit;
IDTEntry* Table;
};
#pragma pack(pop)
IDTR Idtr;
PVOID
GetVector(
IN UCHAR Interrupt
);
VOID
DelVector(
IN UCHAR Interrupt
)
/**
Delete IDT vector
*/
{
if (Idtr.Table == NULL)
__asm sidt fword ptr [Idtr]
Idtr.Table[Interrupt].Present = FALSE;
}
ULONG GetAPICValue (PVOID pAPIC, ULONG xOffset);
ULONG GetIOAPICIntVector (ULONG Vector);
PVOID
IoHookInterrupt (
ULONG Vector,
PVOID NewRoutine);
PVOID
SetVector(
IN UCHAR Interrupt,
IN PVOID Handler,
IN BOOLEAN MakeValid
);