1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
/****************************************************************/
/* Name: noctrl() */
/* Desc: captures interrput 9 so as to ignore ctrl-c,ctrl-break,*/
/* ctrl-alt-del */
/****************************************************************/
#include <dos.h>
#if defined(__ZTC__)
#define INTERRUPT
#define FAR _far
#define ENABLE int_on
#define INPORTB inp
#define OUTPORTB outp
#else
#include <conio.h>
#if defined(__TURBOC__)
#define INTERRUPT interrupt
#define FAR far
#define ENABLE enable
#define INPORTB inportb
#define OUTPORTB outportb
#else
#define INTERRUPT _interrupt
#define FAR _far
#define ENABLE _enable
#define INPORTB inp
#define OUTPORTB outp
#endif
#endif
extern void (INTERRUPT FAR *oldint9)(void); /* Caller must set this */
void INTERRUPT FAR noctrl(void)
{
unsigned char byte;
static int flag;
ENABLE();
if ((byte = (unsigned char)INPORTB(0x60)) == 29)
flag = 1;
if (byte == 157)
flag = 0;
if (!flag)
(*oldint9)();
else switch (byte)
{
case 46 : /* yeah, these should be #defined! */
case 70 :
case 56 :
case 83 :
byte = (unsigned char)INPORTB(0x61);
OUTPORTB(0x61,byte | 0x80);
OUTPORTB(0x61,byte);
OUTPORTB(0x20,0x20);
break;
default :
(*oldint9)();
}
}
|