Solved

How do I write INT 21h extenders?

Posted on 1997-09-08
6
302 Views
Last Modified: 2012-05-04
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?
0
Comment
Question by:maartenp
6 Comments
 
LVL 2

Expert Comment

by:kellyjj
ID: 1215616
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
0
 

Author Comment

by:maartenp
ID: 1215617
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.
0
 

Author Comment

by:maartenp
ID: 1215618
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.
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 1215619
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.
0
 
LVL 3

Expert Comment

by:vmpn
ID: 1215620
I would not advise writing capturing 21H in pascal because of runtime left in the memory.  It would dramaticaly decrease available memory.
0
 
LVL 1

Accepted Solution

by:
eviltekk earned 100 total points
ID: 1215621
{here it is:}

{$M 1400,0,0}

var oldproc : procedure;

procedure newhandler(ax,bx,cx,dx : word}; Interrupt;

function yourfunction : Boolean;
Begin

{....
Your function here}

end;

begin
  if yourfunction then oldproc;  {return to old interrupt}
  asm
    mov ah,2h    {file not found error code}
    retf 0002    {return without doing the old int 21h
  end;
end;

Begin

getintvec($21,@oldproc);
setintvec($21,addr(newhandler));
keep(0);
end.


{thats all.}

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question