Hooking Int 09h interrupt

ⅰ亾dé卋堺 提交于 2019-12-12 14:52:29

问题


I have a problem hooking int 09h I've changed the pointer to my new Isr, if I debug on windows, the interrupt is triggered every time I push a key. But in VMWare it seems that only is triggered one time and no more. I've tested in DOS 6.22 and happens exactly the same.

My code look like this:

MyIsr:
    pusha
    pushf
    ;tell PIC that interrupt has finished
    mov al,0x20
    out 0x20,al
    popf
    popa
    iret

If I use a USB keyboard can I send the same commands like Ps/2?


回答1:


There could be a number of issues here, as you haven't posted a complete view of the code you are writing. Could you please explain exactly what you are tying to accomplish?

If an ISR is called and not handled, you won't be able to do anything, so keep this in mind. Your problem may be related to how you are installing the ISR in the interrupt vector table.

  • In real mode, you do it with INT 21h, AH=25h
  • In protected mode, under DJGPP, you need to use a DPMI function (either using INT 21H functions, or using C functions. See DPMI documentation
  • Locking down the memory for the ISR is also needed when running in PM, as the memory can get "paged out" (You need this for the ISR because we don't really "know" when it will run).

Regardless, your ISR should look more like the following:

newInt9:

enter 0,0
push eax

in al, 60h
mov [raw_key], al

mov al, 20h
out 20h, al

pop eax
leave
iret     

;endproc



来源:https://stackoverflow.com/questions/9566821/hooking-int-09h-interrupt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!