🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #388

Why can't I hook INT 21h???

#388
From: Charlie Hutchins
Date: Mon, 17 Aug 1992 17:43
34 lines
1489 bytes
Okay, maybe someone could help me here.  I am trying to write a TSR
that hooks interrupt 21h but whenever I try and hook that vector I
get an invalid command.com error and my system crashes.  I am using
TC++ 3.0 and I have tryed both using their set vect routine as
well as manually changing the interrupt vector table but in both
cases the same thing happens...crash!  Even if I write an ISR for
INT 21h that simply returns control to the original ISR the system
crahes.  For example, even this crashes my system:

#include <dos.h>
#include <stdio.h>

void interrupt new21handler(void);
void interrupt (*old21handler)();

void main(void)
{
        disable();
        old21handler=getvect(0x21);
        setvect(0x21, new21handler);
        enable();
        keep(0, 4000);
}

void interrupt new21handler(void)
{
        (old21handler)();
}

Anyone know what's wrong here??? As far as I can see this program should
basically do nothing but take up memory but instead, it crahes the system when
run.  Any info would be greatly appreciated.

...Charlie Hutchins
Technical Details
Message-ID: <14340@mindlink.bc.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!rsoft!mindlink!a3133

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!rsoft!mindlink!a3133
From: Charlie_Hutchins@mindlink.bc.ca (Charlie Hutchins)
Newsgroups: alt.msdos.programmer
Subject: Why can't I hook INT 21h???
Message-ID: <14340@mindlink.bc.ca>
Date: 17 Aug 92 17:43:42 GMT
Organization: MIND LINK! - British Columbia, Canada
Distribution: world
Lines: 34