Link to home
Start Free TrialLog in
Avatar of maartenp
maartenp

asked on

How do I write INT 21h extenders?

I want to write a TSR to capture DOS interrupt 21h.  When INT 21h is called, my program should call BooleanFunction, and if BooleanFunction returns True, to call the old int 21h handler as if nothing happened, but if BooleanFunction returns False, to send the "File not found" code back to the application and return from the handler.  Can anyone offer some skeleton code for this?
Avatar of kellyjj
kellyjj

program test;
func true/false
begin
    check something and return true/false
end;

procedure proc: interrupt;
begin
  if true/false then do old handler
else  do my handler
end;

begin
  getintvec(21h,x)
   setintvec(@proc,x)

   keep
end.

I relize that this is very bare code, but I think it should get you going in the right direction
Avatar of maartenp

ASKER

I know how to do that.  I wanted to know about specifics of
capturing interrupt 21.  It has many syntax errors, and from
what I can see, it doesn't give me any information at all!
I am very disappointed with this site.
I just found a better answer on the Usenet.  I can't find
any way to delete this, so I have to leave it here.
NOBODY ANSWER THIS!
Maybe my message will get deleted eventually.
So send a massage to experts-exchange so they will delete your question.

BTW, the best way to capture INT21 is to use some assembler.
With pascal you will have many problem transfering all the registers.
I would not advise writing capturing 21H in pascal because of runtime left in the memory.  It would dramaticaly decrease available memory.
ASKER CERTIFIED SOLUTION
Avatar of eviltekk
eviltekk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial