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: <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 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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(®s,®s); > 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