Solved

How do I write INT 21h extenders?

Posted on 1997-09-08
6
315 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

 
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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Let's recap what we learned from yesterday's Skyport Systems webinar.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

630 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