void RestoreHandlers( void ) { TinySetVect( 0x10, _old10 ); TinySetVect( 0x1b, _old1b ); TinySetVect( 0x23, _old23 ); TinySetVect( 0x24, _old24 ); TinySetVect( 0x28, _old28 ); }
void GrabHandlers( void ) { _old10 = TinyGetVect( 0x10 ); _old1b = TinyGetVect( 0x1b ); _old23 = TinyGetVect( 0x23 ); _old24 = TinyGetVect( 0x24 ); _old28 = TinyGetVect( 0x28 ); TinySetVect( 0x10, Interrupt10 ); TinySetVect( 0x1b, Interrupt1b_23 ); TinySetVect( 0x23, Interrupt1b_23 ); TinySetVect( 0x24, Interrupt24 ); TinySetVect( 0x28, orig28 ); }
void __grab_int_ctrl_break( void ) { if( __old_int_ctrl_break == 0 ) { #if defined(__WINDOWS_386__) __old_int_ctrl_break = _dos_getvect( CTRL_BRK_VEC ); TinySetVect( CTRL_BRK_VEC, (void (_WCNEAR *)(void))__int_ctrl_break_handler ); #elif defined( __386__ ) if( _IsPharLap() ) { __old_int_ctrl_break = pharlap_rm_getvect( CTRL_BRK_VEC ); __old_pm_int_ctrl_break = pharlap_pm_getvect( CTRL_BRK_VEC ); pharlap_setvect( CTRL_BRK_VEC, (pfun) (void (_WCNEAR *)(void))__int_ctrl_break_handler ); } else if( __DPMI_hosted() == 1 ) { DPMILockLinearRegion((long)__int_ctrl_break_handler, ((long)__restore_int23 - (long)__int_ctrl_break_handler)); __old_int_ctrl_break = DPMIGetRealModeInterruptVector( CTRL_BRK_VEC ); __old_pm_int_ctrl_break = DPMIGetPMInterruptVector( CTRL_BRK_VEC ); DPMISetPMInterruptVector( CTRL_BRK_VEC, __int_ctrl_break_handler ); } else { /* what it used to do */ __old_int_ctrl_break = _dos_getvect( CTRL_BRK_VEC ); _dos_setvect( CTRL_BRK_VEC, __int_ctrl_break_handler ); } #else __old_int_ctrl_break = _dos_getvect( CTRL_BRK_VEC ); _dos_setvect( CTRL_BRK_VEC, __int_ctrl_break_handler ); #endif if( __int23_exit == __null_int23_exit ) { __int23_exit = __restore_int_ctrl_break; } else if( __int23_exit == __restore_int23 ) { __int23_exit = __restore_int; } } }
void __restore_int_ctrl_break( void ) { if( __old_int_ctrl_break == 0 ) { return; } if( __int23_exit == __restore_int ) { __int23_exit = __restore_int23; } else if( __int23_exit == __restore_int_ctrl_break ) { __int23_exit = __null_int23_exit; } #if defined(__WINDOWS_386__) TinySetVect( CTRL_BRK_VEC, __old_int_ctrl_break ); #elif defined( __386__ ) if( _IsPharLap() ) { pharlap_rm_setvect( CTRL_BRK_VEC, __old_int_ctrl_break ); pharlap_pm_setvect( CTRL_BRK_VEC, __old_pm_int_ctrl_break ); } else if( __DPMI_hosted() == 1 ) { DPMISetRealModeInterruptVector( CTRL_BRK_VEC, __old_int_ctrl_break ); DPMISetPMInterruptVector( CTRL_BRK_VEC, __old_pm_int_ctrl_break ); } else { _dos_setvect( CTRL_BRK_VEC, __old_int_ctrl_break ); } #else _dos_setvect( CTRL_BRK_VEC, __old_int_ctrl_break ); #endif __old_int_ctrl_break = 0; }
void __restore_int23( void ) { if( __old_int23 == 0 ) { return; } if( __int23_exit == __restore_int ) { __int23_exit = __restore_int_ctrl_break; } else if( __int23_exit == __restore_int23 ) { __int23_exit = __null_int23_exit; } #if defined(__WINDOWS_386__) TinySetVect( 0x23, __old_int23 ); #elif defined( __386__ ) if( _IsPharLap() ) { pharlap_rm_setvect( 0x23, __old_int23 ); pharlap_pm_setvect( 0x23, __old_pm_int23 ); } else if( __DPMI_hosted() == 1 ) { DPMISetRealModeInterruptVector( 0x23, __old_int23 ); DPMISetPMInterruptVector( 0x23, __old_pm_int23 ); } else { /* this is what it used to do */ _dos_setvect( 0x23, __old_int23 ); } #else _dos_setvect( 0x23, __old_int23 ); #endif __old_int23 = 0; }
_WCRTLINK void _dos_setvect( unsigned intnum, void (__interrupt _WCFAR *func)() ) { #if defined(__WINDOWS_386__) TinySetVect( intnum, (void _WCNEAR *) func ); #elif defined(__386__) if( _IsPharLap() ) { pharlap_setvect( intnum, func ); } else { /* DOS/4G style */ dos4g_setvect( intnum, func ); } #else _setvect( intnum, func ); #endif }