Unit Drives

Classes

Functions

DriveReady - standard calls

determins if the drive is ready w/o critical errors enabled
GetDefaultDrive - Gets and sets drive serial number

restore errorsa
GetDeviceParameters - get drive parameters w/o drive access
GetDriveLabel - Tests to see if a drive is ready.
GetDriveSerialNumber - Gets and sets drive label

get volume serial number for a drive: 0=default, 1=A.
GetDriveStyle - Returns current default drive

returns drive type} {read BOIS not drive so floppy does not have to be in drive} {I don't have all types of drive so not all could be tested
GetExtendedErrorInfo - Returns the drive style (hard, 3-1/2, 5-1/4.
IsCDROMDrive - Gets the parameters for the last DOS error.
ReadDriveSNParam - Read Drive parameters: 0=default, 1=A.
SetDriveLabel - sets the label of the drive specified: wDrive: 0=default 1=A.
SetDriveSerialNumber - set volume serial number for a drive: 0=default, 1=A.
WriteDriveSNParam - Write Drive parameters: 0=default, 1=A.

Types

DriveLabel
PDeviceParams
PExtErrorParams
PSerialNumberParams
TDeviceParams
TDriveStyle
TEFCB
TExtErrorParams
TSerialNumberParams

Constants

Variables


Functions


function DriveReady(wDrive: word): boolean;

standard calls

determins if the drive is ready w/o critical errors enabled


function GetDefaultDrive: word;

Gets and sets drive serial number

restore errorsa


function GetDeviceParameters(wDrive: word; var dp: TDeviceParams): boolean;

get drive parameters w/o drive access

function GetDriveLabel(wDrive: word): string;

Tests to see if a drive is ready. (floppy there and door closed

Get label from drive. 0=default, 1=A...} {return string of 11 character or "NO NAME" if not found


function GetDriveSerialNumber(wDrive: word): LongInt;

Gets and sets drive label

get volume serial number for a drive: 0=default, 1=A...} {returns -1 if unable to read


function GetDriveStyle(wDrive: word): TDriveStyle;

Returns current default drive

returns drive type} {read BOIS not drive so floppy does not have to be in drive} {I don't have all types of drive so not all could be tested


procedure GetExtendedErrorInfo(ep: PExtErrorParams);

Returns the drive style (hard, 3-1/2, 5-1/4...

gets last error message from DOS


function IsCDROMDrive(wDrive: word): boolean;

Gets the parameters for the last DOS error. Useful after a DriveReady failure.} {other calls

Determine id drive is a CDROM, 0=default, 1=A ...


function ReadDriveSNParam(wDrive: word; psnp: PSerialNumberParams): boolean;

Read Drive parameters: 0=default, 1=A...} {Note: wDrive and psnp are treate as var with assembler directive} {This interupt does NOT generate a critical error!

function SetDriveLabel(wDrive: word; s: string): boolean;

sets the label of the drive specified: wDrive: 0=default 1=A...} {returns true if it was sucessful

function SetDriveSerialNumber(wDrive: word; SerialNumber: LongInt): boolean;

set volume serial number for a drive: 0=default, 1=A... } {returns true if it was sucessful

function WriteDriveSNParam(wDrive: word; psnp: PSerialNumberParams): boolean;

Write Drive parameters: 0=default, 1=A...} {Note: wDrive and psnp are treate as var with assembler directive} {This interupt does NOT generate a critical error!

Types


DriveLabel = string[11]

PDeviceParams = ^TDeviceParams

PExtErrorParams = ^TExtErrorParams
parameter block to get extened error codes
PSerialNumberParams = ^TSerialNumberParams
parameter block for getting serial number
TDeviceParams = record
bSpecFunc : byte;
bDevType : byte;
wDevAttr : word;
wCylinders : word;
bMediaType : byte;
wBytesPerSec : word;
bSecPerClust : byte;
wResSectors : word;
bFATs : byte;
wRootDirEnts : word;
wSectors : word;
bMedia : byte;
wFATsecs : word;
wSecPerTrack : word;
wHeads : word;
dwHiddenSecs : longInt;
dwHugeSectors : longInt;
reserved : array[0..10] of char;
end;

TDriveStyle = (tUnknown, tNoDrive, t3Floppy, t5Floppy, tFixed, tRFixed,
		tNetwork, tCDROM, tTape);
Drives Unit for: Getting and setting drive labels. Getting and setting drive serial number. Testing if a drive is ready. Determining the type of drive (hard/3.5/5.25...) Return last DOS error status. All procedures and functions are protected from DOS critical errors. Author: William R. Florac Company: FITCO, Verona, WI (wee little company from my house) Copyright 1996, FITCO. All rights reserved. 1) Users of Drives.pas must accept this disclaimer of warranty: This Unit is supplied as is. The Fitco disclaims all warranties, expressed or implied, including, without limitation, the warranties of merchantability and of fitness for any purpose. Fitco assumes no liability for damages, direct or conse- quential, which may result from the use of this Unit." 2) This Unit is donated to the public as public domain except as noted below. 3) You must copy all Software without modification and must include all pages, if the Software is distributed without inclusion in your software product. If you are incorporating the Software in conjunction with and as a part of your software product which adds substantial value, you may modify and include portions of the Software. 4) Fitco retains the copyright for this Unit. You may not distribute the source code (PAS) or its compiled unit (DCU) for profit. 5) If you do find this Unit handy and you feel guilty for using such a great product without paying someone, please feel free to send a few bucks ($25) to support further development. 6) This file was formated with tabs set to 2. Please forward any comments or suggestions to Bill Florac at: email: flash@etcconnect.com www: http://sumac.etcconnect.com/~fitco/ mail: FITCO 209 Jenna Dr Verona, WI 53593 Revision History 2/28/96 1.0 released
TEFCB = record
Flag : byte;
Reserved : array [0..4] of char;
Attribute : byte;
Drive : byte;
Name : array [0..7] of char;
Extension : array [0..2] of char;
Misc : array [0..24] of char;
end;
structure for FCB
TExtErrorParams = record
eCode : word;
eClass : word;
eAction : word;
eLocus : word;
eVolume : String;
end;

TSerialNumberParams = record
wInfoLevel : word;
dwDiskSerialNumber : longint;
caLabel : array[0..10] of char;
baFileSystem : array[0..7] of char;
end;

Constants


Variables