Mike Chambers
Veteran Member
- Joined
- Sep 2, 2006
- Messages
- 2,621
I'm working on a TSR project in Turbo C++ that involves hooking int 13h. I moved the old int handler to int FDh. There are several functions I intercept, but the rest get passed through to the old handler. Every program I've tried works so far, except for DEFRAG.EXE. It hangs at the drive selection screen without displaying the C: drive in the list. The last call to int 13h from it happens right before the hang, it's function 8 (get drive parameters). This is one of the functions I'm forwarding to the old handler. Here's my function passthrough code:
I have custom function exit code to prevent Turbo C++ from restoring the original entry regs when it's done, since I need to modify them and pass them back to the calling application. That code seems to work with everything else, so I don't suspect an issue here:
Any ideas what I'm doing wrong that could cause defrag to hang on function 8?
Code:
default:
{
union REGS inregs, outregs;
struct SREGS sregs;
inregs.h.ah = ah;
inregs.h.al = al;
inregs.h.bh = bh;
inregs.h.bl = bl;
inregs.h.ch = ch;
inregs.h.cl = cl;
inregs.h.dh = dh;
inregs.h.dl = dl;
inregs.x.si = si;
inregs.x.di = di;
sregs.es = es;
inregs.x.flags = flags;
int86x(0xFD, &inregs, &outregs, &sregs);
ah = outregs.h.ah;
al = outregs.h.al;
bh = outregs.h.bh;
bl = outregs.h.bl;
ch = outregs.h.ch;
cl = outregs.h.cl;
dh = outregs.h.dh;
dl = outregs.h.dl;
flags = outregs.x.flags;
es = sregs.es;
si = outregs.x.si;
di = outregs.x.di;
}
break;
I have custom function exit code to prevent Turbo C++ from restoring the original entry regs when it's done, since I need to modify them and pass them back to the calling application. That code seems to work with everything else, so I don't suspect an issue here:
Code:
asm {
mov ax, flags
mov [bp+22], ax
}
_ES = es; _SI = si; _DI = di;
_AH = ah; _AL = al; _BH = bh; _BL = bl; _CH = ch; _CL = cl; _DH = dh; _DL = dl;
asm {
mov sp,bp
add sp,18
iret
}
Any ideas what I'm doing wrong that could cause defrag to hang on function 8?