Category : Communication (modem) tools and utilities
Archive   : TR3-14.ZIP
Filename : TRLOCK.ASM

 
Output of file : TRLOCK.ASM contained in archive : TR3-14.ZIP
; Filename: TRLOCK.ASM
; Author: Douglas Thomson, MUCG, Churchill, Victoria, AUSTRALIA
; Status: Public Domain
; History: 02-Dec-91 prepared source code for release

; Program to completely disable the keyboard of an IBM PC
; Usage:
; trlock
; following which the keyboard will be totally ignored.

DOS equ 21h ; interrupt number for DOS system calls
GETVECT equ 35h ; DOS call to get interrupt vector
SETVECT equ 25h ; DOS call to set interrupt vector
MASKREG equ 21h ; hardware interrupt mask register
OVERFLOW equ 4 ; arithmetic overflow interrupt number
KEYBOARD equ 9 ; keyboard interrupt number
TERMINATE equ 20h ; interrupt number to terminate program

_TEXT segment byte public 'CODE'
assume cs:_TEXT
_main proc near

; First mask out the keyboard interrupt, so that no interrupt is
; generated when a key is pressed.
; This is all that should be necessary, unless some brain-damaged
; software unmasks the keyboard instead of restoring the mask to
; what it was initially...
mov dx, MASKREG
in al, dx
or al, 2
out dx, al

; To protect against such brain-damaged programs, the keyboard
; interrupt vector will be changed so that even if a keyboard
; interrupt occurs, the effect will not be to act on the key,
; but instead to ignore it.
; Ideally the vector should be aimed at an IRET instruction, but
; the next best thing seemed to be the arithmetic overflow
; vector, which virtually no software uses and is 99.99% certain
; to be pointing to an IRET itself...
mov ah, GETVECT
mov al, OVERFLOW
int DOS

; Having retrieved the arithmetic overflow vector in ES:BX, copy
; it to DS:DX and overwrite the keyboard interrupt with it.
; Note that the old vector is not saved anywhere, so as to make it
; harder to restore keyboard function short of re-booting.
mov ah, SETVECT
mov al, KEYBOARD
mov dx, es
mov ds, dx
mov dx, bx
int DOS

; Terminate this program
int 20h
_main endp
_TEXT ends
end _main


  3 Responses to “Category : Communication (modem) tools and utilities
Archive   : TR3-14.ZIP
Filename : TRLOCK.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/