DOS 3.30 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
667 B

5 years ago
  1. /* dpb.c - retrieve DPB for physical drive */
  2. #include "types.h"
  3. #include "sysvar.h"
  4. #include "dpb.h"
  5. #include "cds.h"
  6. extern char NoMem[], ParmNum[], BadParm[] ;
  7. extern struct sysVarsType SysVars ;
  8. /* Walk the DPB list trying to find the appropriate DPB */
  9. long GetDPB(i)
  10. int i ;
  11. {
  12. struct DPBType DPB ;
  13. struct DPBType *pd = &DPB ;
  14. struct DPBType far *dptr ;
  15. int j ;
  16. *(long *)(&dptr) = DPB.nextDPB = SysVars.pDPB ;
  17. DPB.drive = -1 ;
  18. while (DPB.drive != i) {
  19. if ((int)DPB.nextDPB == -1)
  20. return -1L ;
  21. *(long *)(&dptr) = DPB.nextDPB ;
  22. for (j=0 ; j <= sizeof(DPB) ; j++)
  23. *((char *)pd+j) = *((char far *)dptr+j) ;
  24. } ;
  25. return (long)dptr ;
  26. }