INF: How to Determine If DBNMPIPE.EXE Is Loaded from C Program

ID Number: Q66677

1.10 1.11 4.20

MS-DOS

Summary:

This article discusses how a DB-LIBRARY (db-lib) application can

determine whether the DBNMPIPE.EXE TSR is loaded.

More Information:

The following program uses Interrupt 21h Function 35H to find the

address of the current interrupt handler for Interrupt 62h, where the

DBNMPIPE.EXE terminate-and-stay-resident (TSR) program installs

itself. It then compares 9 bytes from that address, after an initial

offset of 2 bytes, to "DBLIBRARY". If the TSR program is loaded, these

bytes will match.

#include <dos.h>

#include <memory.h>

#include <stdio.h>

void main(void) {

union REGS inregs, outregs;

struct SREGS segregs;

int result;

char *ptr;

inregs.h.ah = 0x35;

inregs.h.al = 0x62;

result = int86x(0x21,&inregs,&outregs,&segregs);

FP_OFF(ptr) = outregs.x.bx + 2;

FP_SEG(ptr) = segregs.es;

result = memcmp((char *)ptr,"DBLIBRARY",9);

if (result == 0)

printf("\nDBNMPIPE is loaded\n");

else

printf("\nDBNMPIPE is not loaded\n");

}

Additional reference words: 1.10 1.11 4.20 dblib db-lib DBNMPIPE TSR