Solved

How do I write INT 21h extenders?

Posted on 1997-09-08
6
305 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article explains the steps required to use the default Photos screensaver to display branding/corporate images
ConnectWise and their customers need to ensure critical alerts automatically reach the right person at the right time. MSP superheros efficiently respond to these alerts key is providing automatic, intelligent alerting that generates a complete audi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

830 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