home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.pascal:7746 alt.lang.asm:520
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!gatech!swrinde!network.ucsd.edu!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!ucsvc.ucs.unimelb.edu.au!lugb!lux!cscmd
- Newsgroups: comp.lang.pascal,alt.lang.asm
- Subject: Re: Disable Crtl-Break and C
- Message-ID: <1992Dec30.153520.10692@lugb.latrobe.edu.au>
- From: cscmd@lux.latrobe.edu.au (Mitch Davis)
- Date: Wed, 30 Dec 1992 15:35:20 GMT
- Sender: news@lugb.latrobe.edu.au (USENET News System)
- References: <724545516.AA00000@therose.pdx.com>
- Organization: La Trobe University
- Lines: 209
-
- In article <724545516.AA00000@therose.pdx.com> Phil.Hodges@f601.n105.z1.fidonet.org (Phil Hodges) writes:
- >SL>From: sl9dm@cc.usu.edu
- > >Newsgroups: comp.lang.pascal
- >
- >SL>> How about CTR-ALT-DEL?
- > >Not possible because the computer catches the CTL-ALT-DEL and reboots before
- > >the program sees it.
- >
- > NOT true! Ever hear of interrupt vectors?!!?!?!?!?!?!?!?! Try this unit.
- >
- >UNIT CAD;
-
- Two ideas:
-
- o First, put RemoveCAD into the unit exit procedure so the application
- automatically restores the CAD status upon leaving, and
- o Making it an ASM TSR for size, etc. Try this:
-
- ; Uses TASM. Author: Mitch Davis 30-Dec-92
- .model tiny
- .code
- org 0100h
-
- shifters equ 0417h
- OurShift equ 0Ch ;0Ch for Ctrl-Alt, 06h for Ctrl-Shift, 0Ah for Shift-Alt.
-
- entry:
- jmp main
-
- MyInt09:
- pushf
- push ax ds
- xor ax, ax
- mov ds, ax
- mov al, ds:[Shifters]
- and al, 0Fh
- cmp al, OurShift
- jne Nope
- in al, 60H ;Read port to see what happened.
- and al, 7Fh ;Make BREAK code equal to MAKE code.
- cmp al, 053h
- je Abort
-
- Nope:
- pop ds ax
- popf
- jmp dword ptr cs:[OldInt09h]
-
- Abort:
- ; Reset keyboard
- sti
- in al, 61H
- mov ah, al
- or al, 80h
- out 61h, al
- xchg ah, al
- out 61h, al
- ; Clear PIC
- mov al, 20h
- out 20H, al
- cli
- pop ax ds
- popf
- iret
-
- OldInt09h: dd ?
-
- NonTSR:
-
- Cbreak:
-
- ; Acts as a temporary ^Break handler - stops user pressing Break before
- ; program goes TSR!
-
- pushf
- push ax dx
- mov dx, offset MESS02
- call prmess
- pop dx ax
- popf
- clc
- retf 2
-
- prmess:
- push ds
- push cs
- pop ds
- mov ah, 09
- int 21h
- pop ds
- ret
-
- getintvec:
- push es
- push bx
- mov ah, 35h
- int 21h
- mov ax, bx
- pop bx
- mov [bx], ax
- inc bx
- inc bx
- mov [bx], es
- pop es
- ret
-
- setintvec:
- push dx ds
- mov dx, [bx]
- inc bx
- inc bx
- mov ds, [bx]
- mov ah, 25h
- int 21h
- pop ds dx
- ret
-
- main:
- push cs
- pop ds
-
- mov dx, offset heading
- call prmess
-
- ; Install the Ctrl-Break interrupt handler:
-
- mov bx, offset OldInt23
- mov al, 23h
- call GetIntVec
- mov dx, offset CBreak
- mov ax, 2523h
- int 21h
-
- ; Install the new key handler
-
- mov bx, offset OldInt09h
- mov al, 9h
- call GetIntVec
-
- mov dx, offset MyInt09
- mov ax, 2509h
- int 21h
-
- ; release environment
-
- mov ax, word ptr ds:[002Ch] ; environment segment
- mov es, ax
- mov ah, 49h
- int 21h
-
- ; display exit message
-
- mov dx, offset MESS01
- call prmess
-
- ; Restore old Ctrl-Break handler
-
- mov bx, offset OldInt23
- mov al, 23h
- call SetIntVec
-
- ; Go TSR
- mov ax, 3100h
- mov dx, offset NonTSR
- mov cl, 04
- shr dx, cl
- inc dx
- int 21h
-
- OldInt23: dd ?
- heading: db 13,10,'No Ctrl-Alt-Del version 1.0, by Mitch
- Davis.',13,10,10,'$'
- MESS01: db 'NoCAD has been installed.',13,10,'$'
- MESS02: db '[Ctrl-Break Ignored] $'
- END entry
-
- Or for those of you without TASM:
-
- --8<---------------------------------------------------
- N NOCAD.COM
- E 0100 EB 73 9C 50 1E 33 C0 8E D8 A0 17 04 24 0F 3C 0C
- E 0110 75 08 E4 60 24 7F 3C 53 74 08 1F 58 9D 2E FF 2E
- E 0120 38 01 FB E4 61 8A E0 0C 80 E6 61 86 E0 E6 61 B0
- E 0130 20 E6 20 FA 58 1F 9D CF 00 00 00 00 9C 50 52 BA
- E 0140 13 02 E8 07 00 5A 58 9D F8 CA 02 00 1E 0E 1F B4
- E 0150 09 CD 21 1F C3 06 53 B4 35 CD 21 8B C3 5B 89 07
- E 0160 43 43 8C 07 07 C3 52 1E 8B 17 43 43 8E 1F B4 25
- E 0170 CD 21 1F 5A C3 0E 1F BA C5 01 E8 CF FF BB C1 01
- E 0180 B0 23 E8 D0 FF BA 3C 01 B8 23 25 CD 21 BB 38 01
- E 0190 B0 09 E8 C0 FF BA 02 01 B8 09 25 CD 21 A1 2C 00
- E 01A0 8E C0 B4 49 CD 21 BA F7 01 E8 A0 FF BB C1 01 B0
- E 01B0 23 E8 B2 FF B8 00 31 BA 3C 01 B1 04 D3 EA 42 CD
- E 01C0 21 00 00 00 00 0D 0A 4E 6F 20 43 74 72 6C 2D 41
- E 01D0 6C 74 2D 44 65 6C 20 76 65 72 73 69 6F 6E 20 31
- E 01E0 2E 30 2C 20 62 79 20 4D 69 74 63 68 20 44 61 76
- E 01F0 69 73 2E 0D 0A 0A 24 4E 6F 43 41 44 20 68 61 73
- E 0200 20 62 65 65 6E 20 69 6E 73 74 61 6C 6C 65 64 2E
- E 0210 0D 0A 24 5B 43 74 72 6C 2D 42 72 65 61 6B 20 49
- E 0220 67 6E 6F 72 65 64 5D 20 24
- RCX
- 0129
- W
- Q
- --8<---------------------------------------------------
-
- Extract between the scissors, and pipe it into DOS's DEBUG.
-
- Mitch.
- [Did someone say this was comp.lang.pascal? Sorry.]
-