Mail Archives: djgpp/1995/04/03/08:35:29
I can`t disable standard Ctrl-Break handling in my programm.
Please help!!!
#include <grx.h>
#include <stdio.h>
#include <stdlib.h>
#include <dir.h>
#include <ctype.h>
#include <dos.h>
#include <go32.h>
#include <pc.h>
#include <dpmi.h>
.....
_go32_dpmi_registers regs;
void CBrkHandler(_go32_dpmi_registers *r){
GrSetContext(NULL);
GrLine(0,0,GrScreenX(), GrScreenY(), GrWhite());
usleep(1000000);
memset(r, 0, sizeof(*r));
}
static _go32_dpmi_seginfo oldvector;
static _go32_dpmi_seginfo info;
static _go32_dpmi_seginfo poldvector;
static _go32_dpmi_seginfo pinfo;
void Done0x23(void){
_go32_dpmi_set_real_mode_interrupt_vector(0x23, &oldvector);
_go32_dpmi_free_real_mode_callback(&info);
/*
_go32_dpmi_set_protected_mode_interrupt_vector(0x23, &poldvector);
_go32_dpmi_free_iret_wrapper(&pinfo);
*/
}
#define DD(s, x) printf("%s:%d\n", s, x), usleep(1000000)
/* ------------ initialize the message system --------- */
int StartFunc( int fd ){
atexit(WinTermFunc);
GrSetMode(gmode, wdth, hght, nclr);
if( !MouseDetect() ){
return FALSE;
}
/***************************
Here initializes event queue (from LIBGRX)
*/
if( !WinInit(fd) ) return FALSE;
/**************************
Here initializes CtrlBreak handling
*/
DD("start", 0);
DD("grmiv", _go32_dpmi_get_real_mode_interrupt_vector(0x23,
&oldvector));
info.pm_offset = (long) CBrkHandler;
DD("armci", _go32_dpmi_allocate_real_mode_callback_iret(&info,
®s));
DD("srmiv",_go32_dpmi_set_real_mode_interrupt_vector(0x23,
&info));
/*
DD("gpmiv", _go32_dpmi_get_protected_mode_interrupt_vector(0x23,
&poldvector));
pinfo.pm_offset = (long) CBrkHandler;
DD("aiw", _go32_dpmi_allocate_iret_wrapper(&pinfo));
DD("spmiv", _go32_dpmi_set_protected_mode_interrupt_vector(0x23,
&pinfo));
*/
setcbrk(0);
_go32_want_ctrl_break(1);
atexit(Done0x23);
...
return TRUE;
} /* StartFunc */
.....
- Raw text -