-=> Quoting John Howard to All <=-
JH> stop dos from acknowledging this character?
Hi John
Ever since I've started programming I've been collecting odd
bits of code that I come across just in case it might be useful.
Below is an example. I've never tested it, nor do I claim any
any credit for it. But even if it won't compile it might give
you some ideas.
C yaz
this is an ISR that I use often. It disregards Ctrl-Alt-Del,
Ctrl-C, and Ctrl-Break. Borland flavored. The main() just hooks it up,
shells out to DOS (so you can test it out), then (when you type EXIT),
resets the ISR and exits.
#include
#include
#define C_CODE 0x2E
#define BREAK_CODE 0x46
#define DEL_CODE 0x53
#define CTRLMASK 0x04
#define ALTMASK 0x08
#define KBSTATUS (*(char far*)0x00400017L)
void far interrupt (*old0x09ISR)(void);
void far interrupt new0x09ISR(void);
int main(void)
{
old0x09ISR=getvect(0x09);
setvect(0x09, new0x09ISR);
spawnl("C:\\COMMAND.COM", NULL, NULL);
setvect(0x09, old0x09ISR);
return(0);
}
void far interrupt new0x09ISR(void)
{
unsigned char scancode, status;
scancode=inportb(0x60);
if (!( ((scancode==C_CODE || scancode==BREAK_CODE)
&& (KBSTATUS & CTRLMASK))
|| ((scancode==DEL_CODE)
&& (KBSTATUS & (CTRLMASK|ALTMASK))) ))
{
old0x09ISR();
return;
}
status=inportb(0x61);
outportb(0x61, status | 0x80); // Clear keyboard by disabling,
outportb(0x61, status); // then enabling it
disable();
outportb(0x20, 0x20); // send "End of Interrupt" signal to
enable(); // the interrupt controller port
return;
}
... Diplomacy: Saying "nice doggy" until you find a rock.
---
---------------
* Origin: Community Access Courtenay, BC (604) 338-4597 (1:3412/1)
|