www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/13/07:53:48

Xref: news2.mv.net comp.os.msdos.djgpp:2666
From: u7711501 AT bicmos DOT ee DOT nctu DOT edu DOT tw (Jih-Shin Ho)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Detecting drives
Date: 13 Apr 1996 01:11:25 GMT
Organization: Computer Center, National Chiao-Tung University, Taiwan
Lines: 51
Message-ID: <4kmuvu$ndp@ccnews.nctu.edu.tw>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 960407084756 DOT 22284J-100000 AT is> <4kkbrm$1rk AT news DOT manawatu DOT gen DOT nz>
NNTP-Posting-Host: bicmos2.ee.nctu.edu.tw
NNTP-Posting-User: u7711501
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Malcolm Taylor (malcolm AT manawatu DOT gen DOT nz) wrote:
: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
: 
: 
: >where DJGPP can run.  (You could think that DOS calls are also a solution,
: >but some DPMI servers will GP fault if you try to access an empty drive
: >with a DOS call, so you should hook Int 24h if you want to prevent this.)
: 
: Really? Which DPMI providers do this? I use a findfirst on the drive
: looking for a volume label, which of course fails with no disk in the
: drive. Would this cause a GP fault on some DPMI providers?
: 
: Malcolm
: 

This is what I write to detect disk drive (physical and virtual):
(I compile it with TC)

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

int main()
{
  union REGS regs;
  int i;

  printf("Disk drive found : ");
  for (i = 0; i < 26; ++i) {
    regs.x.ax = 0x4409;      /* get drive flags */
    regs.h.bl = i + 1;  /* 1-based dos drive */
    intdos(&regs,&regs);
    if (!regs.x.cflag) printf("%c ",'A' + i);
  }
  printf("\n");
  return(0);
}


Of course, still many things are left to do.


-- 
  Jih-Shin Ho, National Chiao Tung University
  u7711501 AT bicmos DOT ee DOT nctu DOT edu DOT tw

  DISPLAY -- universal image/movie viewer, converter, and indexer for DOS.
  Package name  : disp???a.zip, disp???b.zip. ??? is version number.
  Official site : NCTUCCCA.edu.tw:/PC/graphics/disp.
  Other site    : oak.oakland.edu:/SimTel/msdos/graphics.
  WWW page      : http://bicmos.ee.nctu.edu.tw/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019