Solved

How do I write INT 21h extenders?

Posted on 1997-09-08
6
292 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 1

Expert Comment

by:FuzzyLogic
Comment Utility
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
Comment Utility
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
Comment Utility
{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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Delphi - What Does "F" Symbolize? 2 470
Extract text from webbrowser 5 1,370
WebCam and Delphi 2 2,495
indy Tmemory stream non latin charcter issue 2 79
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now