#include <dos.h>
#include <stdio.h>
#include <stdlib.h>

typedef struct _DDCB_
{
  unsigned char drv_num;
  unsigned char drv_numd;
  unsigned sec_size;
  unsigned char clu_size;
  unsigned char clu_base;
  unsigned boot_siz;
  unsigned char fat_num;
  unsigned max_dir;
  unsigned data_sec;
  unsigned hi_clust;
  unsigned char fat_size;
  char reserv1;
  unsigned root_sec;
  void far *drv_addr;
  unsigned char media;
  unsigned char acc_flag;
  struct _DDCB_ far *next;
  unsigned reserv2;
  unsigned built;
} DDCB;
typedef DDCB far* LPDDCB;

void main(void);
LPDDCB get_ddcb(unsigned char device_number);

void main(void)
{
 LPDDCB lpDDCB;
 unsigned char dr;

 for(dr=1;; dr++)
 {
   lpDDCB = get_ddcb(dr);
   if(lpDDCB == NULL) break;
     printf("%Fp\n", lpDDCB);
 }
}

LPDDCB get_ddcb(unsigned char device_number)
{
  union  REGS  regs;
  struct SREGS sregs;

  regs.h.ah = 0x32;
  regs.h.al = 0;
  regs.h.dl = device_number;
  intdosx( &regs, &regs, &sregs );
  if(regs.h.al == 0xff)
    return(LPDDCB)NULL;

  return((DDCB far*)MK_FP(sregs.ds, regs.x.bx));
}

