• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

Cheking readiness of removable media drives

We want to write an MS-DOS utiltiy that scans for information across all drives accessible on a user's system.  However we want to skip drives that have removable media (Floppies, CD-Rom, Zip, etc).  This is especially important if there is no media loaded in the drive because it can trigger DOS's "abort, retry, fail" prompt.

We are currently accomplishing this by skipping A: and B: and using some interrupt code to check if each subsequent drive is a CD-ROM.  A customer with a ZIP drive is now haveing the ARF problem because we are not detecting the unloaded ZIP drive and skipping it.  It's an annoyance.

Can the experts suggest a way to detect when a drive with removable media is currently not ready, or perhaps a better way of deciding which drives to skip, or at least a way for a DOS app to recognize a Zip drive.
0
robworley
Asked:
robworley
1 Solution
 
JYoungmanCommented:
Try something like

#include <bios.h>

int drive_ready(int n)
{
   unsigned u = _biosdisk(_DISK_STATUS, NULL);
   return u != 0xAA;            
}

0
 
BonevCommented:
The ARF message is shown by the default Critical Error handler. If you want to avoid it, you have to set your own handler of Int 24h.
0
 
clwells082798Commented:
Elaine Abduction. haha.
0
 
jhurstCommented:
SInce this is the C area I assume that you can use:

harderr(your_routine)  -this function takes as a parameter a routine that you want to perform when an Abort,Retry,Fail error happens.  Basically, you can just ignore the error and recognize that you read nothing.

0
 
robworleyAuthor Commented:
Thanks JHURST:  Your suggestion looks good.  One question though: I just want to ignore ARF errors while this particular function is running.  Once I am done, how do I uninstall my handler and put the default handler back in place?


CLWELLS: I don't really understand what you are saying.  Is Elain Abduction ANSI standard or specific to a given compiler?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now