If we press the 'C' or 'Break' keys in combination with the 'Control' Key, it will terminate the execution of the program.
How I can Stop this?
If we press the 'C' or 'Break' keys in combination with the 'Control' Key, it will terminate the execution of the program.
How I can Stop this?
in config.sys if you put BREAK=OFF it disables the ctrl+c command
-
i'm pretty sure that u can use IOexceptions to trap control characters.
though that's C++ && java rather then C.
look up try, catch, throw in a C++ book for more help.
curiousity killed the cat, but it
makes for one hell of a programmer.
Alien.
Alien.. you might want to look up signal handeling.
I know that in linux a ^C will send a signal to your program.
You can catch the signal and play with it how ever you want
If its in windows im not sure.
HTH
CTRL-BRK is handled by int 23h
Upon exiting your code you should restore all patched vectors. There is no need to restore the int 23h vector according to the DOS tech refs. DOS is supposed to do this automatically.Code:interrupt (*OldBreakHandler)(...) //... for C++ interrupt NewBreakHandler(...) { //Ctrl-brk has been pressed //If this is a NOP then do nothing here } void InstallHandler(void) { disable(); //CLI - no interrupts in this section OldBreakHandler=getvect(0x23); setvect(0x23,NewBreakHandler); enable(); //STI - turn interrupts back on }
An alternate way to patch the vector table is this:
segment=0x0000+(intnum*4)+2;
offset=0x0000+(intnum*4);
Turn this into a far function pointer using MK_FP and just call it like a normal function.
I'm not sure if getvect() and setvect() use this or just call DOS to do it.