www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/15/15:05:21

Xref: news2.mv.net comp.os.msdos.djgpp:2729
From: malcolm AT manawatu DOT gen DOT nz (Malcolm Taylor)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Detecting drives
Date: Mon, 15 Apr 1996 09:14:57 GMT
Organization: Grafik Software
Lines: 27
Message-ID: <4kt7k5$mr3@news.manawatu.gen.nz>
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> <4kmuvu$ndp AT ccnews DOT nctu DOT edu DOT tw>
Reply-To: malcolm AT manawatu DOT gen DOT nz
NNTP-Posting-Host: malcolm.manawatu.gen.nz
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

u7711501 AT bicmos DOT ee DOT nctu DOT edu DOT tw (Jih-Shin Ho) wrote:

>Malcolm Taylor (malcolm AT manawatu DOT gen DOT nz) wrote:
>: 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?
>: 
>This is what I write to detect disk drive (physical and virtual):
>  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);

Does this catch cd-rom drives, remapped Floppies (ie a floppy drive
that is mapped as B: even though it is A:)?
The question I had was about detecting whether the disk was in the
drive. It seems that some DPMI providers will give GP faults if you
try to use a DOS call on an empty drive (ie to see if it is empty).
The only way of detecting a ready CD-ROM drive that I know of (using
int 0x2f) may also cause a crash.
It seems that reading a sector with the BIOS is the only way to get
around this (on floppies).

Malcolm


- Raw text -


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