Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. .386
  2. cseg segment use16
  3. assume CS:cseg, DS:cseg, SS:cseg, ES:cseg
  4. Org 100h
  5.  
  6. ENTRY:
  7. jmp main
  8.  
  9. exit proc
  10. jmp dword ptr cs:[interruptVector]
  11. exit endp
  12.  
  13. removeHook proc
  14. push ds
  15.  
  16. mov dx, word ptr cs:[interruptVector]
  17. mov ds, word ptr cs:[interruptVector+2]
  18. mov ax, 2521h
  19. int 21h
  20.  
  21.  
  22. mov ah, 49h
  23. int 21h
  24.  
  25. pop ds
  26. ret
  27. removeHook endp
  28.  
  29. interruptHook proc
  30. cmp ah, 2ah
  31. jne exit
  32.  
  33. push ds
  34. push ax
  35.  
  36. push cs
  37. pop ds
  38.  
  39. pushf
  40. call dword ptr cs:[interruptVector]
  41.  
  42. mov ah, 09h
  43. lea dx, mess
  44. int 21h
  45.  
  46. call removeHook
  47.  
  48. mov ah, 09h
  49. lea dx, remm
  50. int 21h
  51.  
  52. mov cx, fakeYear
  53. mov dh, fakeMonth
  54. mov dl, fakeDay
  55.  
  56. pop ax
  57. pop ds
  58.  
  59. iret
  60.  
  61. interruptVector dd ?
  62. fakeYear dw 2048
  63. fakeDay db 128
  64. fakeMonth db 16
  65.  
  66. mess db "---",13,10,"Interruption 21h AH = 2ah was intercepted",13,10,"Original registers was changed",13,10,"---",13,10,'$'
  67. startm db "Start interrupt hook, good luck", 13, 10, "$"
  68. remm db "---",13,10,"Remove hook from 21h AH = 2ah, bye :*",13,10,"---",13,10,"$"
  69. interruptHook endp
  70.  
  71. main:
  72. mov ah, 09h
  73. lea dx, startm
  74. int 21h
  75.  
  76. xor dx, dx
  77. xor ax, ax
  78.  
  79. mov ax,3521h
  80. int 21h
  81.  
  82. mov word ptr interruptVector,bx
  83. mov word ptr interruptVector+2,es
  84.  
  85. mov ax,2521h
  86. mov dx,offset interruptHook
  87. int 21h
  88.  
  89. mov ax,4c00h
  90. int 21h
  91. cseg ends
  92. end ENTRY
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement