KEYBOARD INT HOOK 
Author Message
 KEYBOARD INT HOOK

Hi there , I am DHIRAJ
I had written a DOS TSR which hooks interrupt no. 9
i.e. keyboard interrupt.

Function of this TSR was to show every signal
that comes from keyboard(port 60h) , on screen. In
effect whenever key is pressed directly my ISR was
getting called.  So nothing else could be done. And
my ISR(Interrupt Service Routine) was not transferring
control to the old interrupt handler.

So my TSR was there in .COM form on my hard disk
. I have Win95.I came to 'MS-DOS Prompt' option and
entered DOS  shell ; and loaded that TSR in memory.
As expected it was showing every keyboard signal on
screen(that it was receiving through port 60h). It
was even showing CAPS LOCK button signal etc.

But when Win95 special keys were being presses
the TSR was being interrupted and Win95 was getting
active again. In fact there was no way for Win95 to
know that those special keys had been pressed , then
how did it happen. I loaded the TSR after coming to
DOS shell , so even if Win95 hooked INT 9 , it is
again hooked by my Interrupt handler.

So what might be the reason behind it?
Please answer by email..
-DHIRAJ.



Sat, 12 Jan 2002 03:00:00 GMT  
 KEYBOARD INT HOOK

alt.lang.asm:

Quote:
> Hi there , I am DHIRAJ
> I had written a DOS TSR which hooks interrupt no. 9
> i.e. keyboard interrupt.

> Function of this TSR was to show every signal
> that comes from keyboard(port 60h) , on screen. In
> effect whenever key is pressed directly my ISR was
> getting called.  So nothing else could be done. And
> my ISR(Interrupt Service Routine) was not transferring
> control to the old interrupt handler.

> So my TSR was there in .COM form on my hard disk
> . I have Win95.I came to 'MS-DOS Prompt' option and
> entered DOS  shell ; and loaded that TSR in memory.
> As expected it was showing every keyboard signal on
> screen(that it was receiving through port 60h). It
> was even showing CAPS LOCK button signal etc.

> But when Win95 special keys were being presses
> the TSR was being interrupted and Win95 was getting
> active again. In fact there was no way for Win95 to
> know that those special keys had been pressed , then
> how did it happen. I loaded the TSR after coming to
> DOS shell , so even if Win95 hooked INT 9 , it is
> again hooked by my Interrupt handler.

> So what might be the reason behind it?
> Please answer by email..
> -DHIRAJ.

When you run your MS-DOS program under Windows 95, the protected mode
operating system (Win95) runs it in a special mode called virtual 86
mode, usually called V86.  It does not put the processor in real mode.
Also the virtual memory which Windows gives your program to run in
does not contain the real interrupt vector.  In fact since the
operating system is in 32 bit protected mode, there is no interrupt
vector table but something different called an interrupt descriptor
table (IDT), and it is located in memory which your program cannot
access.

All interrupts which occur when your program is running in V86 mode go
switch the processor back into 32 bit mode and use a descriptor from
the 32 bit IDT to determine the interrupt service routine (ISR) to
execute.  So Win95 sees _every_ interrupt when it happens.  Then it
decides whether to handle the interrupt itself, or whether to pass it
along to your MS-DOS program.

When it comes to the keyboard, if the key is one which has special
meaning for Win95 it acts on the key and your program never sees it.
If Win95 doesn't have a special use for the key, it switches the
processor back to V86 mode and calls your interrupt handler.

There is really nothing you can do about this.  One of the meanings of
protected mode is that the operating system can protect itself from
your program.

Jack Klein
--
Home: http://home.att.net/~jackklein



Sat, 12 Jan 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. KEYBOARD INT HOOK

2. Keyboard hooks in VisualAge

3. need help with keyboard hook

4. Keyboard Hook instead of Alert?

5. Keyboard hook and global variables

6. Why is a TSR hooked on int 8 ?

7. Problem hooking INT 21h from TSR

8. Is possible hook Int 21h??

9. Hooking Int 21h

10. hook a vector using int 21h

11. Hooking int 21h

12. Hooking int 21h

 

 
Powered by phpBB® Forum Software