DOS Variables Block (List of Lists)

 This is the undocumented format of the structure whose address is returned
 in ES:BX by the undocumented DOS fn 52H.  This data can be used to learn
 low-level information such as how many drive IDs are recognized and the
 address of the base MemBlockRec.

DosVarsRec
  Offset Size Contents
  ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  -2      2   wBaseMemSeg  ES:[BX-2] is seg of first Memory Control Block
                           ──────────────────────────────────────────────
  +0      4   prBaseDPB    address of first Drive Parameter Block (DPB)
  +4      4   pHandleTbl   address of first system file table
  +8      4   prClockDev   address of CLOCK device header
  +0cH    4   prConDev     address of CON device header
  +10H    2   wMaxSect     maximum sector size for block devices
  +12H    4   pbCache      address of cache head buffer
  +16H    4   parDirs      address of the CurDirRec structure array
  +1aH    4   prFcbTbl     address of system FCB file table
  +1eH    2   wFcbCnt      size of FCB table file table
  +20H    1   bDriveCnt    number of drives in system
  +21H    1   bLastDrive   corresponds to Config.sys LASTDRIVE
          34               size of a DOSVarsRec
                           ──────────────────────────────────────────────
  +22H    18  rNulDevHdr   the DevHdrRec for the NUL device (the start of
                           device driver chain).

 wBaseMemSeg  The segment address of the "base MemBlockRec"  This is the
              lowest allocation in memory.  It may be owned by DOS or
              DoubleSpace.

              Note: This value is located two bytes before the structure
              itself; i.e., after calling fn 52H, it is at ES:[BX-2].

   prBaseDPB  The first Drive Parameter Block.  You can trace the DPB chain
              by accessing the pfrNextDPB field of each structure.
  pHandleTbl  Internal info on each open file (?)
  prClockDev  Address of the DevHdrRec for the CLOCK device
    prConDev  Address of the DevHdrRec for the CON device
    wMaxSect  Largest allowed sector size for block devices (?)
     pbCache  FAR address of DOS's internal disk buffers
     parDirs  FAR address of an array of 88-byte CurDirRec structures.  The
              first item in each structure is an ASCIIZ string that names
              the current default directory for one drive.  There are
              bDriveCnt such records, placed sequentially in memory.
    prFcbTbl  Address of the system FCBRec file table (?)
     wFcbCnt  Number of FCBRecs in the system FCB table
   bDriveCnt  Number of drives (including logical drives) known to the
              system (does not include network drives).
  bLastDrive  A count of the elements in the list pointed to by pparDirs.
              For instance, if you specified LASTDRIVE=Z in your CONFIG.SYS
              file, then this value will be 24 (18H).

  rNulDevHdr  is the actual 18-byte DevHdrRec of the NUL device.  This is
              the start of the device driver chain.  You can locate all
              device drivers by examining the chain of far pointers whose
              first link is at ES:[BX+22H].  It is a 4-byte pointer to the
              next driver.

   Notes: ■ You can use the wBaseMemSeg as the segment address to start
            tracing the memory allocation chain.  You can recognize a PSP
            since it begins with an INT 20H (ie, cd 20).  At offset 2cH of
            a PSP is the address of the DOS environment segment for that
            process (from which you may be able to obtain the fill filespec
            of the program which owns it).

          ■ This structure has apparently been intact since DOS 2.0, but
            Microsoft continues to leave it undocumented as late as 6.0.

See Also: System Information Functions
          fn 52H (get DOS vars address)
          Data Structures
                                    -♦-