Category : Utilities for DOS and Windows Machines
Archive   : FILTER1.ZIP
Filename : FILTER.ASM

 
Output of file : FILTER.ASM contained in archive : FILTER1.ZIP
PAGE ,132
TITLE FILTER - Disables Certain Keys
SUBTTL Disable Certain Keys

; SET TABS TO 8

COMMENT @
*****************************************************************
* FILTER rev 1.0 *
* COPYRIGHT (c) Geoff Drayson Jan. 03, 1989 *
* c/o The Science Lab BBS. (301) 444 0551 *
*****************************************************************

Based on NOBRK by WALTER COX
Released to the public domain.

This is a simple resident program that disables :

(1) Ctrl-C
(2) Ctrl-Break
(3) Ctrl-Alt-Del (Reset)
(4) Shift-PrtSc (Print Screen)
(5) Ctrl-Alt-Grey + (Select High Clock Speed ?)
(6) Ctrl-Alt-Grey - (Select Low Clock Speed ?)

Once installed, this TSR program should prevent the above KEYSTROKES from
stopping (or being seen by) a running program.
The KEY comparison code between Labels CA_KEY & KILL can easily be modified
by deleting or adding additional key combinations.

No code is included in this TSR to disable/remove it once it is intalled.
This would defeat its design purpose.
However, if RESPRO (Public Domain TSR Manager) is loaded BEFORE FILTER,
then FILTER can be Disabled or Removed by RESPRO.
Note: FILTER does not "KILL" RESPRO's Hot key "ALT ~".
(It could be modified to if required !!!!)

This program is provided "AS IS" and the authors assume NO LIABILITY
for damages to appliances, pets or any other items from the use of
this program.

For DOS 2.0 +.
@


CSEG SEGMENT PARA PUBLIC
ASSUME CS:CSEG,DS:CSEG,ES:CSEG


; KB_FLAG Definitions - First Shift Flag
; Bit 0 = Right Shift Key is Depressed
; Bit 1 = Left Shift Key is Depressed
; Bit 2 = Ctrl Key is Depressed
; Bit 3 = Alt Key is Depressed
; Bit 4 = Scroll Lock State is ON
; Bit 5 = NUM Lock State is ON
; Bit 6 = Caps Lock State is ON
; Bit 7 = Insert Mode is ON

RSHIFT EQU 01H ; Right Shift Key is Depressed
LSHIFT EQU 02H ; Left Shift Key is Depressed
CTRL EQU 04H ; Ctrl Key is Depressed
ALT EQU 08H ; Alt Key is Depressed


SEG40 EQU 40H ; Keyboard buffer segment
KBFLAG EQU 17H ; Offset of KBFLAG in SEG 40H
KBINCTL EQU 60H ; Keyboard IN port address
KBCMDP EQU 61H ; Keyboard COMMAND port address


ORG 100H ; .COM programs start at 100H

FILTER: JMP SETUP ; Branch to initialize routine


KBSEG DW SEG40 ; Keyboard Segment


INT09: DW 0,0 ; Store KBD BIOS interrupt 09 hex vector here


; Arrives here after a Keyboard interrupt

CHKKEY: PUSHF ; Save all registers
PUSH AX
PUSH CX
PUSH DI
PUSH SI
PUSH DS
PUSH ES
STI ; Allow other interrupts to occur

MOV AX,CS
MOV DS,AX ; Set DS and ES to this segment

MOV ES,WORD PTR CS:KBSEG ; Segment of keyboard buffer
MOV SI,KBFLAG ; 40:17H Where DOS keeps track of shift state
MOV AH,ES:[SI] ; Get key input


; Check keyboard input
;

AND AH,0FH ; Isolate CTRL ALT L-SHIFT & R-SHIFT
IN AL,KBINCTL ; Get the Key Code
CMP AH,CTRL+ALT ; CTRL ALT ?
JE CA_KEY
CMP AH,CTRL ; CTRL ?
JE C_KEY
CMP AH,RSHIFT ; R-SHIFT ?
JE S_KEY
CMP AH,LSHIFT ; L-SHIFT ?
JE S_KEY
CMP AH,LSHIFT+RSHIFT ; Both L-SHIFT & R-SHIFT ? (!!!)
JE S_KEY
JMP SHORT EXIT ; None of above..Exit to BIOS

; Check CTRL-ALT functions

CA_KEY: CMP AL,83 ; DEL
JE KILL
CMP AL,78 ; Grey +
JE KILL
CMP AL,74 ; Grey -
JE KILL
JMP SHORT EXIT

; Check CTRL functions

C_KEY: CMP AL,46 ; ^C
JE KILL
CMP AL,70 ; ^Break
JE KILL
JMP SHORT EXIT

; Check SHIFT functions (ALL Combinations)


S_KEY: CMP AL,55 ; PrtSc
JE KILL
JMP SHORT EXIT

; Kill the detected functions

KILL: IN AL,KBCMDP ; Read the KB command port
MOV AH,AL ; Copy it to AH
OR AL,80H ; Set RESET bit
OUT KBCMDP,AL ; Write RESET to the command port
MOV AL,AH ; Clear the RESET bit
OUT KBCMDP,AL ; and write to the command port
MOV AL,20H ; Send END OF INTERRUPT to the interrupt cont.
OUT 20H,AL

POP ES ; Restore all registers
POP DS
POP SI
POP DI
POP CX
POP AX
POPF
IRET ; Return to the interrupted routine


; Restore registers and exit to the DOS keyboard interrupt handler

EXIT: POP ES ; Restore all registers
POP DS
POP SI
POP DI
POP CX
POP AX
POPF
JMP DWORD PTR CS:INT09 ; Exit to BIOS keyboard interrupt routine


.XLIST
SUBTTL FILTER initialize routine
PAGE
.LIST

; SETUP - Divert Keyboard Interrupt 09 hex to our program

SETUP: MOV AX,3509H ; Get Interrupt Vector function
INT 21H ; Execute DOS function
MOV WORD PTR INT09,BX ; Store BIOS offset for INT 09
MOV WORD PTR INT09+2,ES ; Store BIOS segment for INT 09
MOV DX,OFFSET CHKKEY; New INT 09 vector
MOV AX,2509H ; Set Interrupt Vector function
INT 21H ; Execute DOS function

SETUP2: MOV DX,OFFSET SETUP ; First address that DOS can use
INT 27H ; Terminate and stay resident function

CSEG ENDS
END FILTER


  3 Responses to “Category : Utilities for DOS and Windows Machines
Archive   : FILTER1.ZIP
Filename : FILTER.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/