home *** CD-ROM | disk | FTP | other *** search
- { FDRIVES.DEC - include file for the PRUSSG unit FDOS to speed up and enhance
- drive related operations under DOS / interface part }
- (***************************************************************************
-
- RELEASE 1.00 - as first contained in the file PRUS101.LZH
- by Orazio Czerwenka, 2:2450/540.55, GERMANY
-
- --------------------------------------------
- organized for Fido's PASCAL related echoes
- --------------------------------------------
-
- 09/06/1994 to --/--/---- by Orazio Czerwenka, 2:2450/540.55, GERMANY
-
-
-
- As far as third party copyrights are not violated this
- source code is hereby placed to the public domain. Use
- it whatever way you want, but use AT YOUR OWN RISK.
-
- In case you should modify the source rather send your
- modifications to the unit's current organizer (see above for
- NM address) than to spread it on your own. This will help to
- keep the unit updated and grant a certain standard to all
- other users as well.
-
- The unit is currently still under work. So it might greatly
- benefit of your participation.
-
- Those who contributed to the following piece of source,
- listed in alphabethical order:
- ================================================================
- Orazio Czerwenka, Andrew Eigus, Peter Schuette ...
- ================================================================
- YOUR NAME WILL APPEAR HERE IF YOU CONTRIBUTE USEFUL SOURCE.
-
- Credits in your own programs are as welcome as unnecessary.
-
- Special thanks to Andrew Eigus (2:5100/33, Latvia) who greatly
- supported this piece of source by contributing a special PD
- version of his Unit ENHDOS.
-
- ***************************************************************************)
-
- CONST
- { -------------------------------------------------------------------------- }
-
- { GetDriveType return values }
-
- dtError = $00; { Bad drive }
- dtFixed = $01; { Fixed drive }
- dtRemovable = $02; { Removable drive }
- dtRemote = $03; { Remote (network) drive }
- dtCDROM = $04; { CD-ROM V2.00+ drive }
- dtCompressed = $05; { Compressed drive }
-
- { -------------------------------------------------------------------------- }
-
- TYPE
- { -------------------------------------------------------------------------- }
-
- { Disk information block structure }
-
- TDiskParamBlock = record
- Drive : byte; { Disk drive number (0=A, 1=B, 2=C...) }
- SubunitNum : byte; { Sub-unit number from driver device header }
- SectSize : word; { Number of bytes per sector }
- SectPerClust : byte; { Number of sectors per cluster -1
- (max sector in cluster) }
- ClustToSectShft : byte; { Cluster-to-sector shift }
- BootSize : word; { Reserved sectors (boot secs; start of root dir }
- FATCount : byte; { Number of FATs }
- MaxDir : word; { Number of directory entries allowed in root }
- DataSect : word; { Sector number of first data cluster }
- Clusters : word; { Total number of allocation units (clusters)
- +2 (number of highest cluster) }
- FATSectors : byte; { Sectors needed by first FAT }
- RootSect : word; { Sector number of start of root directory }
- DeviceHeader : pointer; { Address of device header }
- Media : byte; { Media descriptor byte }
- AccessFlag : byte; { 0 if drive has been accessed }
- NextPDB : pointer { Address of next DPB (0FFFFh if last) }
- end;
- PDiskParamBlock = ^TDiskParamBlock;
-
- { -------------------------------------------------------------------------- }
-
- { Disk allocation data structure }
-
- PDiskAllocInfo = ^TDiskAllocInfo;
- TDiskAllocInfo = record
- FATId : byte; { FAT Id }
- Clusters : word; { Number of allocation units (clusters) }
- SectPerClust : byte; { Number of sectors per cluster }
- SectSize : word { Number of bytes per sector }
- end;
-
- { -------------------------------------------------------------------------- }
-
- function GetVerify : boolean;
- { GETVERIFY - DOS service function
- Description: Returns the state of the verify flag in DOS.
- When off (False), disk writes are not verified.
- When on (True), all disk writes are verified to insure proper
- writing; fn=54h
- Returns: State of the verify flag }
-
- { -------------------------------------------------------------------------- }
-
- function SetVerify(Verify : boolean) : boolean;
- { SETVERIFY - DOS service function
- Description: Sets the state of the verify flag in DOS; fn=2Eh
- Returns: Previous state of the verify flag }
-
- { -------------------------------------------------------------------------- }
-
- function GetCurDisk : byte;
- { GETCURDISK - DOS disk service function
- Description: Retrieves number of disk currently being active; fn=19h
- Returns: Default (current, active) disk number (0=A,1=B,2=C,3=D) }
-
- { -------------------------------------------------------------------------- }
-
- function SetCurDisk(Drive : byte) : byte;
- { SETCURDISK - DOS disk service function
- Description: Sets current (default/active) drive; fn=0Eh
- Returns: Number of disks in the system }
-
- { -------------------------------------------------------------------------- }
-
- procedure GetDriveAllocInfo(Drive : byte; var Info : TDiskAllocInfo);
- { GETDRIVEALLOCINFO - DOS disk service function
- Description: Retrieves disk allocation information; fn=1Ch
- Retrieves Info structure }
-
- { -------------------------------------------------------------------------- }
-
- function GetDPB(Drive : byte; var DPB : TDiskParamBlock) : integer;
- { GETDPB - DOS disk service function (undocumented)
- Description: Returns a block of information that is useful for applications
- which perform sector-level access of disk drives supported by
- device drivers; fn=32h
- Returns: 0 if successful, negative dosrInvalidDrive error code otherwise
- Remarks: Use 0 for default drive }
-
- { -------------------------------------------------------------------------- }
-
- function DiskSize(Drive : byte) : longint;
- { DISKSIZE - DOS disk service function
- Description: Retrieves total disk size; fn=36h
- Returns: Total disk size in bytes if successful, negative dosrInvalidDrive
- error code otherwise
- Remarks: Use 0 for default drive }
-
- { -------------------------------------------------------------------------- }
-
- function DiskFree(Drive : byte) : longint;
- { DISKFREE - DOS disk service function
- Description: Retrieves amount of free disk space; fn=36h
- Returns: Amount of free disk space in bytes if successful,
- negative dosrInvalidDrive error code otherwise
- Remarks: Use 0 for default drive }
-
- { -------------------------------------------------------------------------- }
-
- function IsFixedDrive(Drive : byte) : boolean;
- { ISFIXEDDRIVE - DOS disk service function
- Description: Ensures whether the specified disk is fixed or removable;
- fn=4408h
- Returns: True, if the disk is fixed, False - otherwise
- Remarks: Use 0 for default (current) drive }
-
- { -------------------------------------------------------------------------- }
-
- function IsNetworkDrive(Drive : byte) : boolean;
- { ISNETWORKDRIVE - DOS disk service function
- Description: Ensures whether a specified disk drive is a network drive;
- fn=4409h
- Returns: True if drive is a network drive, False if it's a local drive
- Remarks: Use 0 for detecting the default (current) drive }
-
- { -------------------------------------------------------------------------- }
-
- function IsCDROMDrive(Drive : byte) : boolean;
- { ISCDROMDRIVE -
- Returns True if a specified drive is a CD-ROM drive, False - if not }
-
- { -------------------------------------------------------------------------- }
-
- function IsCompressedDrive(Drive : byte) : boolean;
- { ISCOMPRESSEDDRIVE-
- Detects whether a specified drive is a compressed drive; Returns
- True if drive is compressed, False - if not; Drives: 0=A,1=B,2=C... }
-
- { -------------------------------------------------------------------------- }
-
- function GetDriveType(Drive : byte) : byte;
- { GETDRIVETYPE - Disk service function
- Description: Detects type for a specified drive
- Returns: One of (dt) constants (see const section)
- Remarks: 0=detect current (default),1=A,2=B,3=C... }
-
- { -------------------------------------------------------------------------- }
-
- function LogicalDrives : string;
- { LOGICALDRIVES -
- reports all existing logical drives within a string, e.g. "ABCEG" }
-
- { -------------------------------------------------------------------------- }
-
- function DriveExists(drive: char) : boolean;
- { DRIVEEXISTS -
- reports FALSE for an invalid drive, TRUE if the specified drive does
- exist in LOGICALDRIVES }
-
- { -------------------------------------------------------------------------- }
-
- {
- internal comments and remarks can be found in FDRIVES.INC
- }