19-01-2013, 02:55 PM
HOT KEYS, INTERRUPT HOOKS AND TSR
HOT KEYS,.ppt (Size: 112 KB / Downloads: 33)
INTERRUPT HOOKS
An interrupt hook allows a program to interrupt the interrupt structure of the computer system.Interrupts that are commonly hooked into are clock-tick interrupt (vector 8) and the keyboard interrupt (vector 9).Most interrupt hooks are written with assembly language rather than high-level language.
HOT KEYS
A hot key is a special keystroke, or a combination of keystrokes that invokes access to a TSR program.A hot key is composed of a key scan code and a code found in memory location 0000:0417.A program accessed by a hot key is often called a pop-up program.
TSR :- Terminate and stay resident
A TSR program is executed and then placed in the memory until the computer is turned off.The TSR is accessed by the interrupt structure of the computer and can be activated by a special key sequence i.e. hot key.Most TSR programs are assembled as .COM programs instead of .EXE programs.
WHY INTERRUPTS NEED TO BE HOOKED?
One reason is to change the behavior of the system services exported by the operating system.By hooking the software interrupts, you can write monitoring applications. Hooking can prove useful in studying operating system internals. This can also serve as a way to hook system services.
Linking to an interrupt
Interrupts must be intercepted to perform some
tasks for I/O devices.
eg: the PC contains a keyboard interrupt that is intercepted to use a hot key. (as in below fig.)
In below fig the hook gains access prior to normal
interrupt service provider, which is allowed by the
intercept.
Hooking into the clock-tick interrupt
The clock tick interrupt is a constant on all PCs that occurs about 18.2 times a second & uses vector 8.
Suppose we need to beep a speaker every half hour. This can be done using clock-tick interrupt.
Below fig shows control and operation of speaker in the PC.
8253- triple timer IC is used.
Removable TSR
The above discussed TSR remains in the memory until the system is rebooted or restarted. But the TSR can also be removed. The removable TSR can be installed if INT 2FH (the multiplex interrupt) is used during its installation.
In DOS INT 2FH, AH register contains the ID num of TSR, ranging from 192 to 255.
Each installed TSR also contains a character string that identifies the TSR so it can be removed or detected.