Category : C++ Source Code
Archive   : C_ALL.ZIP
Filename : TI711.ASC

 
Output of file : TI711.ASC contained in archive : C_ALL.ZIP







PRODUCT : Borland C++ NUMBER : 711
VERSION : 2.0
OS : DOS
DATE : August 12, 1992 PAGE : 1/2

TITLE : Disabling CTRL-BREAK and CTRL-C





/**********************************************************

The following code shows how to disable CTRL-BREAK and
CTRL-C.

************************************************************/

#include
#include
#include

char far *modifiers = MK_FP(0,0x417); /* address of modifier
flags */
void interrupt (*oldint9) (void); /* storage for old INT 9
handler */

void interrupt myint9(void)
{
/* ((*modifiers)&4)==4 indicates the CTRL key is being pressed

inportb(0x60)==46 indicates the C key is being pressed
inportb(0x60)==70 indicates the SCROLL LOCK/BREAK key "

The emit code is required to clean the keypress up from

the BIOS.
*/

if( (((*modifiers)&4)==4) &&
((inportb(0x60)==46) || (inportb(0x60)==70)) )
__emit__(0xe4,0x61, /* asm IN AL,61 */
0x8a,0xe0, /* asm MOV AH,AL */
0x0c,0x80, /* asm OR AL,80 */
0xe6,0x61, /* asm OUT 61,AL */
0x86,0xe0, /* asm XCHG AL,AH */
0xe6,0x61, /* asm OUT 61,AL */
0xb0,0x20, /* asm MOV AL,20 */
0xe6,0x20); /* asm OUT 20,AL */
else
/* If the key is not CTRL-C or CTRL-BREAK, call the old INT 9
handler */
oldint9();













PRODUCT : Borland C++ NUMBER : 711
VERSION : 2.0
OS : DOS
DATE : August 12, 1992 PAGE : 2/2

TITLE : Disabling CTRL-BREAK and CTRL-C




}

void exitfunc(void)
{
/* Restore the old INT 9 handler */
setvect(9,oldint9);
}

main()
{
int i;

oldint9=getvect(9); /* store old interrupt vector */
setvect(9,myint9); /* set up new interrupt handler */
atexit(exitfunc); /* set up exit handler to restore INT 9*/

/* ... */ /* code that will not CTRL-BREAK or CTRL-C */

return 0;
}

DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.


























  3 Responses to “Category : C++ Source Code
Archive   : C_ALL.ZIP
Filename : TI711.ASC

  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/