Category : C Source Code
Archive   : BCPPTECH.ZIP
Filename : TI396.ASC

 
Output of file : TI396.ASC contained in archive : BCPPTECH.ZIP







PRODUCT : TURBO C NUMBER : 396
VERSION : 1.0
OS : PC-DOS
DATE : November 18, 1987 PAGE : 1/1

TITLE : CAPTURING INTERRUPTS




The following program demonstrates the use of getvect and setvect
to safely capture and restore interrupt vectors. This code could
be easily modified to disable the print screen utility during
program execution.

#include
#include

void interrupt (*oldfunc)();
int __LOOPING__ = 1;

/*--------------------------------------------------------------------
* get_out - this is our new interrupt routine
*------------------------------------------------------------------*/
void interrupt get_out() {
setvect(5,oldfunc); /* restore to original interrupt routine */

__LOOPING__ = 0;

}

/*--------------------------------------------------------------------
* capture_prtscr - installs a new interrupt for
* arguments : func -- new interrupt function pointer
*------------------------------------------------------------------*/
void capture_prtscr(void interrupt (*func)()) {
oldfunc = getvect(5); /* save the old interrupt */
setvect(5,func); /* install our interrupt handler */
}

void main () {

puts("Press to terminate");
capture_prtscr(get_out); /* capture the print screen interrupt */

while (__LOOPING__)
; /* do nothing */

puts("Success");
}











  3 Responses to “Category : C Source Code
Archive   : BCPPTECH.ZIP
Filename : TI396.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/