Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!amdahl!oliveb!sun!burgundy!jborza From: jborza%burgundy@Sun.COM (Jim_Borza) Newsgroups: comp.sys.ibm.pc Subject: Re: problems trying to intercept msdos function requests Summary: Try this! Message-ID: <89938@sun.uucp> Date: 15 Feb 89 22:19:32 GMT References: <3204@ttrdc.UUCP> Sender: news@sun.uucp Lines: 72 In article <3204@ttrdc.UUCP>, levy@ttrdc.UUCP (Daniel R. Levy) writes: > Hello again, and thanks to all the folks who replied to my earlier request > for info about talking PC software. > > With just enough understanding of MS-DOS to be dangerous, I am now trying to > do something screwey, that is, intercept calls to the MS-DOS function > requests (that are made through interrupt 21h). This is so that I can do > something even screwier (that is, to make a UNIX-structured floppy look to > programs running on the PC like a MS-DOS file system, as much as is possible > given the braindamage of the MS-DOS file system). This is a research project > I've committed to for a class I am taking at Northwestern, so I can't back > out of it. > > My problem is that I can't even seem to make a do-nothing intercept program do > what I want. [...] > > CATCH: > > ; make the real system call > > int 88h > iret > > CODE ends > > STACK segment stack > assume ss:STACK > dw 64 dup(?) > STACK ends > > end START > -- > Daniel R. Levy Mr. Gopal (an earlier respondent) was correct in looking at the FLAGS register as a potential source of your problem. DOS returns significant information in the FLAGS register. The problem occurs because an int xx instruction pushes the FLAGS register on the stack and then pushes the seg:offset. When the DOS call returns from its interrupt, your CATCH routine overwrites the FLAGS register, restoring it to the value it had prior to the int 21h call. You will need to "capture" the value returned in the FLAGS register before issuing your iret at the end of the CATCH procedure. The value you pushed for FLAGS will, at the con- clusion of the int 88h, be at sp-6; the value returned by DOS will be in FLAGS. One way around this may be to manipulate the registers so that the FLAGS returned by DOS is on the stack at the right place (sp-6) or another way might be to code CATCH so it doesn't monkey with FLAGS on its return. An example: CATCH proc FAR int 88h ret 2 CATCH endp This should return to the point of interrupt with a FAR return rather than an iret. The only difference is the FLAGS register. The value of 2 in the ret instruction tells the 8086 to bump the stack pointer by 2 in order to ignore the FLAGS word you pushed initially. Of course, since this is a "do nothing" routine, it's simple. God help us all if you really want to "do something"! :-o <-- (Mr. Bill) I think the iret from DOS will re-enable interrupts but you might want to code an "sti" following the int 88h for safety. I haven't tried this but I think it's a good place to start. Jim Borza - Sun Microsystems Disclaimer? Sure, why not?