#pragma
inline
#include
"dos.h"
struct
INTERRUPT
{
unsigned
bp,di,si,ds,es,dx,cx,bx,ax,ip,cs,fl;
};
void
interrupt dispopen(struct INTERRUPT);
void
interrupt (*prev)();
char
far *vdu=(char far*)0xb8000000l;
char
filename[127];
char
far *fname;
int i;
main()
{
//AIM :
to display name of every file that is open when the TSR is active
unsigned long far *int21ptr;
int21ptr=(unsigned long far*)(0x21*4);
prev=(void (interrupt far*)())*int21ptr;
*int21ptr=(unsigned long)dispopen;
keep(0,1000);
return 0;
}
void
interrupt dispopen(struct INTERRUPT r)
{
void writestr(char *,int,int,int);
if
((_AH==61)||(_AH==62)|(_AH==75))
{
fname=(char
far*)MK_FP(r.ds,r.dx);
i=0;
while(filename[i++]=*fname++);
writestr(filename,10,10,240);
}
asm pop bp;
asm pop di;
asm pop si;
asm pop ds;
asm pop es;
asm pop dx;
asm pop cx;
asm pop bx;
asm pop ax;
asm jmp cs:_prev;
}
void
writestr(char *str,int row,int col, int attr)
{
void writechr(char,int,int,int);
while (*str)
{
writechr(*str,row,col,attr);
str++;
col++;
}
}
void
writechr(char fchar,int row,int col,int attr)
{
*(vdu+(row*160)+(col*2))=fchar;
*(vdu+(row*160)+(col*2)+1)=attr;
}