home *** CD-ROM | disk | FTP | other *** search
- From: Phil.Hodges@f601.n105.z1.fidonet.org (Phil Hodges)
- Sender: postmaster@therose.pdx.com
- Path: sparky!uunet!psgrain!qiclab!therose!postmaster
- Newsgroups: comp.lang.pascal
- Subject: Disable Crtl-Break and C
- Message-ID: <724545516.AA00000@therose.pdx.com>
- Date: Mon, 14 Dec 1992 03:49:06 -0700
- Lines: 93
-
- SL>From: sl9dm@cc.usu.edu
- >Newsgroups: comp.lang.pascal
-
- >> What sort of code do I need to include in a pascal program (writen in
- >> Borland Pascal 6.0) to disable CTRL-BREAK and CTRL-C?
-
- 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.
- All you need to do is put Uses CAD, and it will disable C-A-D in your
- programs.
- You have to call RestoreCAD before leaving the program.
-
- UNIT CAD;
-
- INTERFACE
-
- USES Dos;
-
- VAR
- Int9Handler : POINTER;
-
- PROCEDURE InterceptCtrlAltDel;
- PROCEDURE RestoreCAD;
-
- IMPLEMENTATION
-
- PROCEDURE InterceptCtrlAltDel; Assembler;
-
- CONST
- Ctrl = 4;
- Alt = 8;
- Del = $53;
- KbdPort = $60; { Keyboard port }
- KbdCtrlPort = $61; { Keyboard control port }
- PIC = $20; { 8259 Interrupt controller }
- EOI = $20; { End-of-interrupt }
-
- ASM
-
- PUSH AX
- PUSH DS
- MOV AX, SEG @Data
- MOV DS, AX
- STI
- IN AL, KbdPort
- AND AL, 01111111b
- CMP AL, Del
- JNE @2
-
- @1 : MOV AH, 2 { BIOS Get keyboard flags service }
- INT 16h
- TEST AL, Ctrl + Alt
- JNZ @3
-
- @2 : PUSHF
- CALL [Int9Handler]
- JMP @4
-
- @3 : IN AL, KbdCtrlPort
- MOV AH, AL
- OR AL, 10000000b
- OUT KbdCtrlPort, AL
- XCHG AH, AL
- OUT KbdCtrlPort, AL
- CLI
-
- MOV AL, EOI
- OUT PIC, AL
- @4 : POP DS
- POP AX
- IRET { make sure we return correctly }
- END; { InterceptCtrlAltDel }
-
- PROCEDURE RestoreCAD;
-
- BEGIN
- SETINTVEC (9, Int9Handler);
- END; { RestoreCAD }
-
-
- BEGIN
- GETINTVEC (9, Int9Handler);
- SETINTVEC (9, @InterceptCtrlAltDel);
- END. {Unit CAD}
-
-
- * SLMR 2.1a * COBOL programmers understand why women hate periods.
-
-