Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .386
- cseg segment use16
- assume CS:cseg, DS:cseg, SS:cseg, ES:cseg
- Org 100h
- ENTRY:
- jmp main
- exit proc
- jmp dword ptr cs:[interruptVector]
- exit endp
- removeHook proc
- push ds
- mov dx, word ptr cs:[interruptVector]
- mov ds, word ptr cs:[interruptVector+2]
- mov ax, 2521h
- int 21h
- mov ah, 49h
- int 21h
- pop ds
- ret
- removeHook endp
- interruptHook proc
- cmp ah, 2ah
- jne exit
- push ds
- push ax
- push cs
- pop ds
- pushf
- call dword ptr cs:[interruptVector]
- mov ah, 09h
- lea dx, mess
- int 21h
- call removeHook
- mov ah, 09h
- lea dx, remm
- int 21h
- mov cx, fakeYear
- mov dh, fakeMonth
- mov dl, fakeDay
- pop ax
- pop ds
- iret
- interruptVector dd ?
- fakeYear dw 2048
- fakeDay db 128
- fakeMonth db 16
- mess db "---",13,10,"Interruption 21h AH = 2ah was intercepted",13,10,"Original registers was changed",13,10,"---",13,10,'$'
- startm db "Start interrupt hook, good luck", 13, 10, "$"
- remm db "---",13,10,"Remove hook from 21h AH = 2ah, bye :*",13,10,"---",13,10,"$"
- interruptHook endp
- main:
- mov ah, 09h
- lea dx, startm
- int 21h
- xor dx, dx
- xor ax, ax
- mov ax,3521h
- int 21h
- mov word ptr interruptVector,bx
- mov word ptr interruptVector+2,es
- mov ax,2521h
- mov dx,offset interruptHook
- int 21h
- mov ax,4c00h
- int 21h
- cseg ends
- end ENTRY
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement