|
Refer to "80386 Programming in Protected Mode" or the first volume of Intel manual (available for download on Intel website)
98 can read and write directly after class, for example, the following assembly program rewrites the interrupt:
.386
.model flat, stdcall
option casemap: none
include windows.inc
include kernel32.inc
include user32.inc
INTNUM equ 9
includelib kernel32.lib
includelib user32.lib
.data
szAppName db "Ring0 Try--using IDT",0
szFormat db "My INT %u handler return the value of CRO: %08X",0
szMsg db 512 dup(0)
IDTR df 0
OldGate dq 0
MyGate dw 0
dw 28h
dw 0EE00h
dw 0
.code
start:
;construct my call gate
mov eax, IntHandler
mov MyGate, ax
shr eax, 16
mov [MyGate+6], ax
;save old IDT
sidt IDTR
mov ebx, dword ptr [IDTR+2]
add ebx, 8*INTNUM
push ebx
mov esi, ebx
mov edi, offset OldGate
cld
movsd
movsd
;modify IDT
mov edi, ebx
mov esi, offset MyGate
cli
movsd
movsd
;interrupt!
sti
int INTNUM
;restore IDT
pop edi
mov esi, offset OldGate
cli
movsd
movsd
sti
;OK!
invoke wsprintf, addr szMsg, addr szFormat, INTNUM, eax
invoke MessageBox, NULL, addr szMsg, addr szAppName, MB_OK
invoke ExitProcess, 0
IntHandler:
mov eax, cr0
iretd
end start
But NT/2000/XP does not work, you need to write a kernel driver. |
|