The information in this article applies to:
SUMMARYThe MS-DOS DB-Library (DB-Lib) versions 1.1 and later use a terminate-and-stay-resident (TSR) utility to interface with the network. This utility, written to the OpenNet specification, is the connection between DB-Lib and whatever network the TSR is coded to communicate with. Because this utility is a TSR, interrupts are required to allow code execution paths from DB-Lib to the TSR. When the MS-DOS Extenders are used in protected mode, the interrupt driver scheme in DB-Lib fails to correctly interface with the TSR in real mode. This document is designed to provide enough information to the DB-Lib application developer to correctly call the TSR from protected mode to real mode. MORE INFORMATION
The TSR consists of eight C routines managed by an assembly language
interrupt manager. The eight routines are accessed via INT 62H, with
AH containing the index to the requested function. The indexes are as
follows:
The interrupt manager in the TSR examines AH for the index. To verify that INT 62H is targeted to the TSR, the DX value must be -1 and the CX value must be -2. If any of these values are not correct, the TSR calls through the original INT 62H vector. When the DB-Lib interrupt handler is called by the low-level db-lib routines that want to communicate with the TSR, a series of actions occur. The parameters for the TSR functions are pushed on the stack in the same order as listed below, without the INTRMAP but with the addition of the index value for example, in a call that ultimately would be processed by ConnectionTransact():
The following push sequence occurs:
Once in the interrupt handler, the above code pushes BP, SI, and DI to save local registers in the usual C function stack frame setup. The db-lib interrupt manager then examines the index to make sure it is in range, then sets CX and DX to the verification values -2 and -1, respectively. An INT 62H is then executed. This results in the flags register being pushed and CS:IP. The TSR now has control. The index value is verified, and the verification values in CX and DX are then checked. The TSR then pushes DS to preserve the application's data segment, then it loads the DGROUP segment for the TSR into DS. The TSR now calls through a jump table to the C routine requested. When the C routine receives control, the INTRMAP is pushed on the stack as shown in the prototypes. On return from the C routine to the interrupt manager in the TSR, the application's DS is popped from the stack and an IRET is executed. The INTRMAP and TSR function declarations are listed below. Note that ALL pointers are far, and that the TSR is compiled in large model and expects only far pointers (after all, you cannot do an interprocess call and expect to use near pointers).
The INTRMAP structure represents the state of the stack when the function receives control:
All return values are returned in AX. For an MS-DOS Extender to operate with this TSR, several conditions must be met:
Now the Extender routine has to map the buffers into real mode, using a buffer size as indicated for each function. Push these onto a real mode stack as indicated for the requested function. The index value can be examined from the stack to determine what the current stack configuration is. Then, switch to real mode and do the new INT, whatever that may be. Upon return to the Extender routine, the real mode buffers have to be remapped to protected mode, along with any other values set into pointer buffers (neterrno, and so on). Switch out of real mode and IRET to db-lib. Protected mode is now successfully integrated into real mode. Once in real mode in the TSR, the network redirector calls execute correctly, because the switch to real mode has already been accomplished. Upon exit from the Extender program, the INT 62H vector MUST be restored to allow other applications to use the TSR and to allow ENDDBLIB.EXE to unload the TSR. Additional query words: dblib
Keywords : kbprg SSrvDB_Lib |
Last Reviewed: March 11, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |