home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / DRIVE.ZIP / DRIVE.DOC next >
Encoding:
Text File  |  1988-10-30  |  4.2 KB  |  97 lines

  1. DRIVE.PAS - Routine for classifying disk drives
  2. -----------------------------------------------
  3.  
  4. TurboPower Software
  5. 10/88
  6. Version 1.0
  7. Released to the public domain
  8.  
  9. Overview
  10. ------------------------------------------------------------------------------
  11.  
  12. DRIVE.PAS contains a single routine, GetDiskClass, that attempts to classify
  13. the type of disk installed in a specified drive. It recognizes all of the most
  14. common disk types, and it has been tested on a variety of machines running
  15. virtually every major version of DOS from 2.0 to 4.0. Nevertheless, we feel
  16. obliged to warn you that it uses an undocumented DOS function ($32), and that
  17. it should therefore be used with some measure of caution.
  18.  
  19. We developed this routine for use in our own commercial software, specifically
  20. an installation program that needs to know whether a particular drive contains
  21. a floppy disk or some other form of removable media. You may find other uses
  22. for it.
  23.  
  24. Using DRIVE
  25. ------------------------------------------------------------------------------
  26.  
  27. DRIVE.PAS contains the following type and procedure declarations:
  28.  
  29. type
  30.   DiskClass = (
  31.     Floppy360, Floppy720, Floppy12, Floppy144, OtherFloppy, Bernoulli,
  32.     HardDisk, RamDisk, SubstDrive, UnknownDisk, InvalidDrive);
  33.  
  34.   This type defines the eight disk types that can be identified by DRIVE,
  35.   as well as several types indicating that a particular error occurred. The
  36.   meaning of each value is described briefly below:
  37.  
  38.     Floppy360     A 360K, 5 1/4 floppy disk
  39.     Floppy720     A 720K, 3 1/2 floppy disk
  40.     Floppy12      A 1.2 meg, 5 1/4 floppy disk
  41.     Floppy144     A 1.44 meg, 3 1/2 floppy disk
  42.     OtherFloppy   Another kind of floppy disk (e.g. a single-sided disk)
  43.     Bernoulli     A Bernoulli drive
  44.     HardDisk      Any hard disk
  45.     RamDisk       A RAM disk created with VDISK.SYS, RAMDRIVE.SYS, etc.
  46.     SubstDrive    A logical drive created by SUBST or ASSIGN
  47.     UnknownDisk   Indicates that the drive could not be classified
  48.     InvalidDrive  Indicates that the drive does not exist or isn't ready
  49.  
  50. function GetDiskClass(Drive : Char; var SubstDriveChar : Char) : DiskClass;
  51.   {-Return the disk class for the drive with the specified letter}
  52.  
  53.    Given a drive letter ('A'..'Z'), this routine returns a value indicating
  54.    what kind of disk is installed in the specified drive. The possible return
  55.    values are described in the documentation for DiskClass.
  56.  
  57.    There are two special cases that you should be aware of. First, the DOS
  58.    ASSIGN program allows you to treat one existing drive as another. For
  59.    example
  60.  
  61.       ASSIGN B=C
  62.  
  63.    would cause all disk I/O pertaining to drive B to be routed to drive C.
  64.    Similarly, the DOS SUBST program allows you to create a new logical drive
  65.    from an existing drive or directory. For example,
  66.  
  67.      SUBST H: C:\TURBO
  68.  
  69.    would allow you to refer to the directory "C:\TURBO" as drive H.
  70.  
  71.    GetDiskClass is able to recognize both of these situations (though it
  72.    cannot distinguish between them). When it does, it will return 'SubstDrive'
  73.    as its function result, and it will pass back the letter of the actual
  74.    drive being used for the specified Drive in SubstDriveChar. In the case of
  75.    the second example above (involving SUBST), SubstDriveChar would be set to
  76.    'C' if the drive parameter were 'H'. Note that SubstDriveChar will always
  77.    be equal to Drive if the function result is something other than
  78.    SubstDrive.
  79.  
  80. Limitations
  81. ------------------------------------------------------------------------------
  82.  
  83. GetDiskClass cannot recognize the type of a floppy drive, only the type of the
  84. disk that is in it (if any). For example, a 1.2 meg floppy drive will be
  85. classified as Floppy360 if it has a 360K disk in it.
  86.  
  87. GetDiskClass does not currently recognize optical drives, nor does it
  88. identify several rarely-used floppy disk types (single-sided floppies), for
  89. example.
  90.  
  91. Credits
  92. ------------------------------------------------------------------------------
  93.  
  94. Thanks go to our many friends on the Borland Programmer's Forum A on CompuServe
  95. who helped in the testing of this routine. There were too many testers to name
  96. them all here. You know who you are, and so do we. We appreciate your help.
  97.