Unit Filesystem

From Ultibo.org
Revision as of 01:17, 7 June 2017 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


Ultibo FileSystem interface unit

Numbering of Devices, Partitions, Volumes, Drives etc


Example:

Machine with 2 Floppy drives, 2 Fixed drives

Fixed Drive 1 has 2 Partitions (1 Primary and 1 Extended)

Fixed Drive 2 has 1 Partition (1 Primary)

\Floppy0 = Device 00h/Partition 0

\Floppy1 = Device 01h/Partition 0

\Harddisk0\Partition1 = Device 80h/Partition 1

\Harddisk0\Extended1 = Device 80h/Extended 1

\Harddisk0\Partition2 = Device 80h/Partition 2

\Harddisk1\Partition1 = Device 81h/Partition 1

\Volume1 = \Floppy0

\Volume2 = \Floppy1

\Volume3 = \Harddisk0\Partition1

\Volume4 = \Harddisk1\Partition1

\Volume5 = \Harddisk0\Partition2

A: = \Volume1

B: = \Volume2

C: = \Volume3 (Alternate Name = \HarddiskVolume1)

D: = \Volume4 (Alternate Name = \HarddiskVolume2)

E: = \Volume5 (Alternate Name = \HarddiskVolume3)

Constants



FileSystem specific constants FILESYS_*
FILESYS_LOGGING_DESCRIPTION = 'Filesystem Logging';  
 
FILESYS_STORAGE_TIMER_INTERVAL = 500;  


FileSystem lock state FILESYS_LOCK_*
FILESYS_LOCK_NONE = 0;  
FILESYS_LOCK_READ = 1;  
FILESYS_LOCK_WRITE = 2;  
FILESYS_LOCK_AUTO = 3; Not intended for use in all situations, use with extreme caution.


FileSystem cache FILESYS_CACHE_*
FILESYS_CACHE_THREAD_NAME = 'Filesystem Cache'; Thread name for Filesystem cache threads
FILESYS_CACHE_THREAD_PRIORITY = THREAD_PRIORITY_HIGHER; Thread priority for Filesystem cache threads
 
FILESYS_CACHE_TIMER_INTERVAL = 50; 50ms timer interval for Filesystem cache
FILESYS_CACHE_FLUSH_TIMEOUT = 3000; Filesystem cache flush timeout 3 seconds
FILESYS_CACHE_DISCARD_TIMEOUT = 180000; Filesystem cache discard timeout 3 minutes


FileSystem entry timer FILESYS_ENTRY_*
FILESYS_ENTRY_TIMER_INTERVAL = 1000; 1000ms timer interval for Filesystem entries
FILESYS_ENTRY_DELETE_TIMEOUT = 30000; Filesystem entry delete timeout 30 seconds


FileSystem cache timer CACHE_TIMER_*
CACHE_TIMER_KEY_NONE = TIMER_KEY_NONE;  
CACHE_TIMER_KEY_MAX = TIMER_KEY_MAX;  
CACHE_TIMER_KEY_MIN = TIMER_KEY_MIN;  


FileSystem entry timer key ENTRY_TIMER_KEY_*
ENTRY_TIMER_KEY_NONE = TIMER_KEY_NONE;  
ENTRY_TIMER_KEY_MAX = TIMER_KEY_MAX;  
ENTRY_TIMER_KEY_MIN = TIMER_KEY_MIN;  


FileSystem partition, device and volume *_PARTITION, *_DEVICE, *_VOLUME
MIN_FLOPPY_DEVICE = $00;  
MAX_FLOPPY_DEVICE = $7F;  
 
MIN_FIXED_DEVICE = $80;  
MAX_FIXED_DEVICE = $FF; Extends over CDROM/Other
 
MIN_CDROM_DEVICE = $E0;  
MAX_CDROM_DEVICE = $EF;  
 
MIN_OTHER_DEVICE = $F0;  
MAX_OTHER_DEVICE = $FF;  
 
INVALID_PARTITION = -1;  
INVALID_DEVICE = -1;  
INVALID_VOLUME = 0;  
 
MIN_PARTITION = 0;  
MAX_PARTITION = 3;  
MAX_EXTENDED = 1; Only 2 partitions in second level
 
MIN_FLOPPY_DRIVE = MIN_DRIVE;  
MAX_FLOPPY_DRIVE = MIN_DRIVE + 1;  
 
MIN_FIXED_DRIVE = MIN_DRIVE + 2;  
MAX_FIXED_DRIVE = MAX_DRIVE;  
 
MIN_SECTOR_SIZE = 512;  
MAX_SECTOR_SIZE = 4096;  
ISO_SECTOR_SIZE = 2048;  
 
VOLUME_PREFIX = '\Volume'; eg \Volume1
EXTENDED_PREFIX = '\Extended'; eg \Extended1
PARTITION_PREFIX = '\Partition'; eg \Partition1
CONTROLLER_PREFIX = '\Controller'; eg \Controller0
CDROM_DEVICE_PREFIX = '\Cdrom'; eg \Cdrom0
OTHER_DEVICE_PREFIX = '\Other'; eg \Other0
FIXED_DEVICE_PREFIX = '\Harddisk'; eg \Harddisk0
FLOPPY_DEVICE_PREFIX = '\Floppy'; eg \Floppy0
UNKNOWN_DEVICE_PREFIX = '\Unknown'; eg \Unknown0
 
VOLUME_PATH_PREFIX = '\\?'; eg \\?\Volume1\Home
DEVICE_PATH_PREFIX = '\\.'; eg \\.\Harddisk0\Partition1\Home
REPARSE_PATH_PREFIX = '\??\';  
 
BOOT_RECORD_SIGNATURE = $AA55;  
PARTITION_RECORD_SIGNATURE = $AA55;  
BOOT_SECTOR_SIGNATURE = $AA55;  


FileSystem find flag FIND_FLAG_*
FIND_FLAG_NONE = $00000000;  
FIND_FLAG_FILE_NAMES = $00000001;  


FileSystem find wildcard FIND_WILDCARD_*
FIND_WILDCARD_NAME = '*.*';  
FIND_WILDCARD_STREAM = '*';  


File mode fm*Mask
fmOpenMask = $000F;  
fmShareMask = $00F0;  


File attribute fa*
faDot = $01000000;  
faDotDot = $02000000;  
faFile = $04000000;  
faStream = $08000000;  
faFlagName = $00100000; Used for FAT case flags
faFlagExt = $00200000; Used for FAT case flags
faFlagBoth = (faFlagName or faFlagExt);  
faFlagLong = $00400000; Not currently used
faFlagMetafile = $00800000; Used for NTFS Metafiles
 
faFlagMask = $0FFF0000; Used to preserve internal attributes
faFindMask = $0000FFFF; Used to mask internal attributes
faMatchMask = (faFile or faStream or faVolumeID or faDirectory);  
 
Additional File Attribute Flags for NTFS/EXTFS/NSS
faDevice = $00000040; Note: Conflicts with faSymLink in FPC SysUtils (filutilh.inc)
faNormal = $00000080;  
faTemporary = $00000100;  
faSparse = $00000200;  
faReparse = $00000400;  
faCompressed = $00000800;  
faOffline = $00001000;  
faNotIndexed = $00002000;  
faEncrypted = $00004000;  
 
faMftDirectory = $10000000; Used only by FileName Attribute
faMftIndexView = $20000000; Used by both the StandardInformation and FileName attributes
 
Note: NTFS does not store the faVolumeID or faDirectory attributes
 
Additional File Attribute constants
faNone = $00000000;  
faStandard = (faReadOnly or faHidden or faSysFile or faArchive);  
faLongName = (faReadOnly or faHidden or faSysFile or faVolumeID);  
faLongMask = (faReadOnly or faHidden or faSysFile or faVolumeID or faDirectory or faArchive);  


FileSystem volume attribute va*
vaNone = $00000000;  
vaCaseSensitive = $00000001;  
vaCasePreserved = $00000002;  
vaUnicode = $00000004;  
vaPersistentAcls = $00000008;  
vaFileCompression = $00000010;  
vaVolumeQuotas = $00000020;  
vaSparseFiles = $00000040;  
vaReparsePoints = $00000080;  
vaRemoteStorage = $00000100;  
vaLongNamesApi = $00004000;  
vaVolumeCompressed = $00008000;  
vaObjectIds = $00010000;  
vaEncryption = $00020000;  
vaNamedStreams = $00040000;  
vaReadOnly = $00080000;  
 
Additional Volume Attribute constants
vaBootCatalog = $01000000; Used to indicate support for ISO Boot Catalogs
vaVirtualVolume = $02000000; Used to indicate Volume is Virtual or on a Virtual Device
vaFolderEncryption = $04000000; Used to indicate support for Folder Encryption (New files in folder are automatically encrypted)
vaFolderCompression = $08000000; Used to indicate support for Folder Compression (New files in folder are automatically compressed)


FileSystem device attribute da*
daNone = $00000000;  
daWriteable = $00000001;  
daVirtual = $00000002;  


FileSystem image attribute ia*
iaNone = $00000000;  
iaDisk = $00000001; Memory/File/Device (All others always Disk)
iaPartition = $00000002; Memory/File/Device
iaVolume = $00000004; Memory/File/Device
iaDrive = $00000008; Memory/File/Device
iaCDROM = $00000010; Memory/File/Device/Iso
iaDVD = $00000020; Memory/File/Device/Iso
iaFlat = $00000040; Bochs
iaSparse = $00000080; Bochs
iaGrowing = $00000100; Bochs
iaFixed = $00000200; Vpc/Vbox/Vmware
iaDynamic = $00000400; Vpc/Vbox/Vmware
iaSplit = $00000800; Vpc/Vmware/WIM/Ghost/Portlock/Powerquest
iaUndoable = $00001000; Vpc/Vbox/Vmware
 
iaReadable = $00010000; All
iaWriteable = $00020000; All
iaEraseable = $00040000; All


FileSystem catalog attribute ca*
caNone = $00000000;  
caDefault = $00000001; Initial/Default Entry
caBootable = $00000002; Boot Indicator
caNoEmulation = $00000004; No Emulation
caFloppy12M = $00000008; 1.2M
caFloppy144M = $00000010; 1.44M
caFloppy288M = $00000020; 2.88M
caHardDisk = $00000040; Hard Disk


FileSystem miscellaneous NAME_HASH_SIZE*
NAME_HASH_SIZE = 8; Used for Internal Name Hash Generation only


FileSystem partition Id pid*
See http://www.win.tue.nl/~aeb/partitions/partition_types-1.html
 
MAX_PARTITION_ID = 255;  
pidUnused = 0; Empty
pidFAT12 = 1;  
pidXENIXROOT = 2;  
pidXENIXUSR = 3;  
pidFAT16 = 4; under 32M
pidExtended = 5;  
pidFAT16HUGE = 6; over 32M
pidHPFSNTFS = 7;  
pidAIXOS2 = 8;  
pidAIX = 9;  
pidOS2BOOT = 10;  
pidFAT32 = 11;  
pidFAT32LBA = 12;  
pidUnknown013 = 13;  
pidFAT16LBA = 14;  
pidExtLBA = 15;  
pidOPUS = 16;  
pidHIDDEN12 = 17;  
pidCompaqDiag = 18;  
pidUnknown019 = 19;  
pidHIDDEN16 = 20;  
pidUnknown021 = 21;  
pidHIDDEN16HUGE = 22;  
pidHIDDENHPFS = 23;  
pidASTSWAP = 24;  
pidWillowtech = 25;  
pidUnknown026 = 26;  
pidHIDDEN32 = 27;  
pidHIDDEN32LBA = 28;  
pidUnknown029 = 29;  
pidHIDDEN16LBA = 30;  
pidUnknown031 = 31;  
pidWillowsoft = 32;  
pidOxygen = 33;  
pidOxygenExtended = 34;  
pidReserved035 = 35;  
pidNECMSDOS = 36;  
pidUnknown037 = 37;  
pidUnknown038 = 38;  
pidUnknown039 = 39;  
pidUnknown040 = 40;  
pidUnknown041 = 41;  
pidUnknown042 = 42;  
pidUnknown043 = 43;  
pidUnknown044 = 44;  
pidUnknown045 = 45;  
pidUnknown046 = 46;  
pidUnknown047 = 47;  
pidUnknown048 = 48;  
pidReserved049 = 49;  
pidAlienNOS = 50;  
pidReserved051 = 51;  
pidReserved052 = 52;  
pidOS2JFS = 53;  
pidReserved054 = 54;  
pidUnknown055 = 55;  
pidTheos057 = 56;  
pidPlan9 = 57;  
pidTheos058 = 58;  
pidTheos059 = 59;  
pidPowerQuest = 60;  
pidHiddenNetware = 61;  
pidUnknown062 = 62;  
pidUnknown063 = 63;  
pidVENIX286 = 64;  
pidPersonalRISC = 65;  
pidSFS = 66;  
pidPTSDOS = 67;  
pidGoBack = 68;  
pidEUMEL069 = 69;  
pidEUMEL070 = 70;  
pidEUMEL071 = 71;  
pidEUMEL072 = 72;  
pidUnknown073 = 73;  
pidAdaOS = 74;  
pidUnknown075 = 75;  
pidOberon = 76;  
pidQNX4077 = 77;  
pidQNX4078 = 78;  
pidQNX4079 = 79;  
pidOnTrack080 = 80;  
pidNOVELL081 = 81;  
pidCPM = 82;  
pidOnTrack083 = 83;  
pidOnTrack084 = 84;  
pidEZDrive = 85;  
pidGoldenBow = 86;  
pidUnknown087 = 87;  
pidUnknown088 = 88;  
pidUnknown089 = 89;  
pidUnknown090 = 90;  
pidUnknown091 = 91;  
pidPriamEdisk = 92;  
pidUnknown093 = 93;  
pidUnknown094 = 94;  
pidUnknown095 = 95;  
pidUnknown096 = 96;  
pidSpeedStor097 = 97;  
pidUnknown098 = 98;  
pidSysV = 99;  
pidNetware286 = 100;  
pidNWFS = 101; Traditional/Netware 6 Master
pidUnknown102 = 102;  
pidNovell103 = 103;  
pidNovell104 = 104;  
pidNSS = 105; NSS/Netware 6
pidUnknown106 = 106;  
pidUnknown107 = 107;  
pidUnknown108 = 108;  
pidUnknown109 = 109;  
pidUnknown110 = 110;  
pidUnknown111 = 111;  
pidDiskSecure = 112;  
pidUnknown113 = 113;  
pidUnknown114 = 114;  
pidReserved115 = 115;  
pidReserved116 = 116;  
pidPCIX = 117;  
pidReserved118 = 118;  
pidUnknown119 = 119;  
pidUnknown120 = 120;  
pidUnknown121 = 121;  
pidUnknown122 = 122;  
pidUnknown123 = 123;  
pidUnknown124 = 124;  
pidUnknown125 = 125;  
pidUnknown126 = 126;  
pidUnknown127 = 127;  
pidMinix = 128;  
pidLinuxMinix = 129;  
pidLinuxSwap = 130;  
pidLinuxNative = 131;  
pidHIDDENC = 132;  
pidLinuxExtended = 133;  
pidFAT16Stripe = 134;  
pidNTFSStripe = 135;  
pidUnknown136 = 136;  
pidUnknown137 = 137;  
pidUnknown138 = 138;  
pidUnknown139 = 139;  
pidUnknown140 = 140;  
pidUnknown141 = 141;  
pidUnknown142 = 142;  
pidUnknown143 = 143;  
pidUnknown144 = 144;  
pidUnknown145 = 145;  
pidUnknown146 = 146;  
pidAmoeba = 147;  
pidAmoebaBBT = 148;  
pidUnknown149 = 149;  
pidUnknown150 = 150;  
pidUnknown151 = 151;  
pidUnknown152 = 152;  
pidUnknown153 = 153;  
pidUnknown154 = 154;  
pidUnknown155 = 155;  
pidUnknown156 = 156;  
pidUnknown157 = 157;  
pidUnknown158 = 158;  
pidUnknown159 = 159;  
pidPhoenixPM = 160;  
pidReserved161 = 161;  
pidUnknown162 = 162;  
pidReserved163 = 163;  
pidReserved164 = 164;  
pidFreeBSD = 165;  
pidOpenBSD = 166;  
pidNeXTStep = 167;  
pidUnknown168 = 168;  
pidUnknown169 = 169;  
pidUnknown170 = 170;  
pidDarwinBoot = 171;  
pidUnknown172 = 172;  
pidUnknown173= 173;  
pidUnknown174 = 174;  
pidUnknown175 = 175;  
pidUnknown176 = 176;  
pidUnknown177 = 177;  
pidUnknown178 = 178;  
pidUnknown179 = 179;  
pidReserved180 = 180;  
pidUnknown181 = 181;  
pidFAT16MirrorA = 182;  
pidNTFSMirrorA = 183;  
pidBSDIswap = 184;  
pidUnknown185 = 185;  
pidUnknown186 = 186;  
pidUnknown187 = 187;  
pidUnknown188 = 188;  
pidUnknown189 = 189;  
pidUnknown190= 190;  
pidUnknown191 = 191;  
pidUnknown192 = 192;  
pidDRDOSFAT12 = 193;  
pidUnknown194 = 194;  
pidUnknown195 = 195;  
pidDRDOSFAT16 = 196;  
pidUnknown197 = 197;  
pidFAT16MirrorB = 198;  
pidNTFSMirrorB = 199;  
pidUnknown200 = 200;  
pidUnknown201 = 201;  
pidUnknown202 = 202;  
pidUnknown203 = 203;  
pidUnknown204 = 204;  
pidUnknown205 = 205;  
pidUnknown206 = 206;  
pidUnknown207 = 207;  
pidUnknown208 = 208;  
pidUnknown209 = 209;  
pidTinyEFAT = 210;  
pidEFAT = 211;  
pidSecuredEFAT = 212;  
pidOpticalEFAT = 213;  
pidUnknown214 = 214;  
pidUnknown215 = 215;  
pidCPM86 = 216;  
pidUnknown217 = 217;  
pidUnknown218 = 218;  
pidConcurrentCPM = 219;  
pidUnknown220 = 220;  
pidUnknown221 = 221;  
pidUnknown222 = 222;  
pidUnknown223 = 223;  
pidUnknown224 = 224;  
pidSpeedStorFAT12 = 225;  
pidUnknown226 = 226;  
pidUnknown227 = 227;  
pidSpeedStorFAT16 = 228;  
pidReserved229 = 229;  
pidReserved230 = 230;  
pidUnknown231 = 231;  
pidUnknown232 = 232;  
pidUnknown233 = 233;  
pidUnknown234 = 234;  
pidBeOSBFS1 = 235;  
pidUnknown236 = 236;  
pidUnknown237 = 237;  
pidUnknown238 = 238;  
pidUnknown239 = 239;  
pidLinuxRISC = 240;  
pidStorageDimension = 241;  
pidDOS33Secondary = 242;  
pidSpeedStor243 = 243;  
pidSpeedStor244 = 244;  
pidPrologue = 245;  
pidSpeedStor246 = 246;  
pidOSGEFAT = 247;  
pidUnknown248 = 248;  
pidUnknown249 = 249;  
pidBochsX86 = 250;  
pidVMware = 251;  
pidVMwareSwap = 252;  
pidLinuxRAID = 253;  
pidLANstep = 254;  
pidXenixBBT = 255;  
 
PARTITION_NAMES:array[0..MAX_PARTITION_ID] of String = (
'Unused',  
'FAT12',  
'XENIX ROOT',  
'XENIX USR',  
'FAT16 (up to 32M)',  
'Extended',  
'FAT16 (over 32M)',  
'HPFS or NTFS',  
'AIX or OS/2',  
'AIX',  
'OS/2 Boot Manager',  
'FAT32',  
'FAT32 (LBA)',  
'Unknown',  
'FAT16 (LBA)',  
'Extended (LBA)',  
'OPUS',  
'Hidden FAT12',  
'Compaq Diagnostic',  
'Unknown',  
'Hidden FAT16 (<32M)',  
'Unknown',  
'Hidden FAT16 (>32M)',  
'Hidden HPFS',  
'AST SWAP',  
'Willowtech',  
'Unknown',  
'Hidden FAT32',  
'Hidden FAT32 (LBA)',  
'Unknown',  
'Hidden FAT16 (LBA)',  
'Unknown',  
'Willowsoft',  
'Oxygen',  
'Oxygen Extended',  
'Reserved',  
'NEC MS-DOS 3.X',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Reserved',  
'Alien NOS',  
'Reserved',  
'Reserved',  
'OS/2 JFS',  
'Reserved',  
'Unknown',  
'Theos',  
'Plan 9',  
'Theos',  
'Theos',  
'PowerQuest Recovery',  
'Hidden Netware',  
'Unknown',  
'Unknown',  
'VENIX 80286',  
'Personal RISC',  
'SFS',  
'PTS-DOS',  
'GoBack',  
'EUMEL/Elan',  
'EUMEL/Elan',  
'EUMEL/Elan',  
'EUMEL/Elan',  
'Unknown',  
'AdaOS Aquila',  
'Unknown',  
'Oberon',  
'First QNX 4.0',  
'Second QNX 4.0',  
'Third QNX 4.0',  
'OnTrack DM',  
'NOVELL',  
'CP/M',  
'OnTrack DM',  
'OnTrack DM',  
'EZ Drive',  
'GoldenBow',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Priam Edisk',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'SpeedStor',  
'Unknown',  
'Sys V / Mach / HURD',  
'Netware 286',  
'Netware 386',  
'Unknown',  
'Novell',  
'Novell',  
'Netware NSS',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'DiskSecure',  
'Unknown',  
'Unknown',  
'Reserved',  
'Reserved',  
'PC/IX',  
'Reserved',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Minix v1.1-1.4a',  
'Linux / Minix',  
'Linux Swap',  
'Linux Native',  
'Hidden C:',  
'Linux Extended',  
'FAT16 Stripe Set',  
'NTFS Stripe Set',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Amoeba',  
'Amoeba BBT',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Phoenix Power Management',  
'Reserved',  
'Unknown',  
'Reserved',  
'Reserved',  
'FreeBSD',  
'OpenBSD',  
'NeXTStep',  
'Unknown',  
'Unknown',  
'Unknown',  
'Apple Darwin Boot',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Reserved',  
'Unknown',  
'FAT16 Mirror (Master)',  
'NTFS Mirror (Master)',  
'BSDI Swap',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'DR-DOS FAT12',  
'Unknown',  
'Unknown',  
'DR-DOS FAT16',  
'Unknown',  
'FAT16 Mirror (Slave)',  
'NTFS Mirror (Slave)',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Tiny EFAT',  
'EFAT',  
'Secured EFAT',  
'Optical EFAT',  
'Unknown',  
'Unknown',  
'CP/M-86',  
'Unknown',  
'Unknown',  
'Concurrent CP/M',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'SpeedStor FAT12',  
'Unknown',  
'Unknown',  
'SpeedStor FAT16',  
'Reserved',  
'Reserved',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'BeOS BFS-1',  
'Unknown',  
'Unknown',  
'Unknown',  
'Unknown',  
'Linux/PA-RISC',  
'Storage Dimension',  
'DOS 3.3+ Secondary',  
'SpeedStor',  
'SpeedStor',  
'Prologue',  
'SpeedStor',  
'OSG EFAT',  
'Unknown',  
'Unknown',  
'BochsX86',  
'VMware',  
'VMware Swap',  
'Linux RAID',  
'LANstep',  
'Xenix BBT');  


FileSystem device description FILESYS_*_DEVICE_DESCRIPTION
FILESYS_ATA_DEVICE_DESCRIPTION = 'ATA Storage Device';  
FILESYS_ATAPI_DEVICE_DESCRIPTION = 'ATAPI Storage Device';  
FILESYS_SCSI_DEVICE_DESCRIPTION = 'SCSI Storage Device';  
FILESYS_USB_DEVICE_DESCRIPTION = 'USB Storage Device';  
FILESYS_MMC_DEVICE_DESCRIPTION = 'MMC/SD Storage Device';  


FileSystem controller description FILESYS_*_CONTROLLER_DESCRIPTION
FILESYS_ATA_CONTROLLER_DESCRIPTION = 'ATA Storage Controller';  
FILESYS_ATAPI_CONTROLLER_DESCRIPTION = 'ATAPI Storage Controller';  
FILESYS_SCSI_CONTROLLER_DESCRIPTION = 'SCSI Storage Controller';  
FILESYS_USB_CONTROLLER_DESCRIPTION = 'USB Storage Controller';  
FILESYS_MMC_CONTROLLER_DESCRIPTION = 'MMC/SD Storage Controller';  


FileSystem logging FILESYS_LOG_*
FILESYS_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG; FileSystem debugging messages
FILESYS_LOG_LEVEL_INFO = LOG_LEVEL_INFO; FileSystem informational messages, such as a filesystem being mounted or dismounted.
FILESYS_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR; FileSystem error messages
FILESYS_LOG_LEVEL_NONE = LOG_LEVEL_NONE; No FileSystem messages


Type definitions



Storage device event

PStorageDeviceEvent = ^TStorageDeviceEvent;

TStorageDeviceEvent = record

Timer:TTimerHandle;  
Device:PStorageDevice;  

Cache timer

PCacheTimerItem = ^TCacheTimerItem;

TCacheTimerItem = record

Key:Integer; Ordering key for timer list
Page:TObject; The cache page referenced by this timer list item
Prev:PCacheTimerItem; Previous item in timer list
Next:PCacheTimerItem; Next item in timer list

Entry timer

PEntryTimerItem = ^TEntryTimerItem;

TEntryTimerItem = record

Key:Integer; Ordering key for timer list
Entry:TObject; The disk entry referenced by this timer list item
Prev:PEntryTimerItem; Previous item in timer list

Media type

TMediaType = (mtUNKNOWN,mtINVALID,mtFLOPPY,mtFIXED,mtREMOVABLE,mtCDROM,mtDVD,mtOTHER);

Floppy type

TFloppyType = (ftUNKNOWN,ftINVALID,ft360K,ft12M,ft720K,ft144M,ft288M,ftATAPI);

Image type

TImageType = (itUNKNOWN,itINVALID,itMEMORY,itFILE,itDEVICE,itISO,itBOCHS,itVMWARE,itVPC,itVBOX);

Cache state

TCacheState = (csCLEAN,csDIRTY);

Cache mode

TCacheMode = (cmNONE,cmREADONLY,cmREADWRITE);

Cache page type

TCachePageType = (ptNONE,ptDEVICE);

Cache page state

TCachePageState = (psUNKNOWN,psEMPTY,psCLEAN,psDIRTY);

Cache page content

TCachePageContent = (pcUNKNOWN,pcDATA,pcDIRECTORY,pcENTRY,pcSYSTEM);

Cache statistics

PCacheStatistics = ^TCacheStatistics;

TCacheStatistics = record

Information
PageSize:LongWord;  
PageCount:LongWord;  
CacheSize:LongWord;  
CacheMode:TCacheMode;  
CacheState:TCacheState;  
FlushTimeout:LongWord;  
DiscardTimeout:LongWord;  
Read/Write
ReadCached:Int64;  
ReadDirect:Int64;  
WriteBack:Int64;  
WriteThrough:Int64;  
WriteDirect:Int64;  
Hit/Miss
HitCount:Int64;  
MissCount:Int64;  
Allocate Success/Failure
FailCount:Int64;  
SuccessCount:Int64;  
Page Flush/Discard
FlushCount:Int64;  
DiscardCount:Int64;  
UnknownCount:Int64;  
Page Times
OldestClean:Int64;  
NewestClean:Int64;  
OldestDirty:Int64;  
NewestDirty:Int64;  

Search

TSearchRec = SysUtils.TRawbyteSearchRec;

TSearchRec = record

Note: TSearchRec is always defined in SysUtils
Time: Integer;  
Size: Integer;  
Attr: Integer;  
Name: TFileName;  
ExcludeAttr: Integer;  
FindHandle: THandle;  
FindData: TWin32FindData;  

File search

TFileSearchRec = record

FindHandle:THandle;  
FindData:TWin32FindData;  

Disk search

TDiskSearchRec = record

Name:String;  
MediaType:TMediaType;  
FloppyType:TFloppyType;  
FindHandle:THandle;  
Context:LongWord;  
Verbose:Boolean;  

Partition search

TPartitionSearchRec = record

Name:String;  
Index:LongWord;  
FindHandle:THandle;  
Context:LongWord;  
Verbose:Boolean;  

Volume search

TVolumeSearchRec = record

Name:String;  
Attributes:LongWord;  
VolumeLabel:String;  
VolumeGUID:String;  
VolumeSerial:LongWord;  
DriveType:TDriveType;  
FileSysType:TFileSysType;  
FindHandle:THandle;  
Context:LongWord;  
Verbose:Boolean;  

Drive search

TDriveSearchRec = record

Name:String;  
Attributes:LongWord;  
VolumeLabel:String;  
VolumeGUID:String;  
VolumeSerial:LongWord;  
DriveType:TDriveType;  
FileSysType:TFileSysType;  
FindHandle:THandle;  
Context:LongWord;  
Verbose:Boolean;  

Image search

TImageSearchRec = record

Name:String;  
ImageNo:Integer;  
ImageType:TImageType;  
MediaType:TMediaType;  
FloppyType:TFloppyType;  
Attributes:LongWord;  
SectorSize:Word;  
SectorCount:Int64;  
Cylinders:LongWord;  
Heads:LongWord;  
Sectors:LongWord;  
PartitionId:Byte;  
FindHandle:THandle;  
Context:LongWord;  
Verbose:Boolean;  

Catalog search

TCatalogSearchRec = record

Name:String;  
Path:String;  
CatalogNo:LongWord;  
MediaType:TMediaType;  
FloppyType:TFloppyType;  
Attributes:LongWord;  
SectorSize:Word;  
SectorCount:Int64;  
FindHandle:THandle;  
Context:LongWord;  

Mount search

TMountSearchRec = record

Name:String;  
FindHandle:THandle;  
Context:LongWord;  

Junction search

TJunctionSearchRec = record

Name:String;  
FindHandle:THandle;  
Context:LongWord;  

Stream search

TStreamSearchRec = record

FindHandle:THandle;  
Context:Pointer;  
FindData:TWin32FindStreamData;  

Link search

TLinkSearchRec = record

Name:String;  
FindHandle:THandle;  
Context:Pointer;  

FAT12/FAT16 BIOS parameter block

TBiosPB = packed record

BytesPerSector:Word; 512,1024,2048,4096 - Usually 512
SectorsPerCluster:Byte; 1,2,4,8,16,32,64,128
ReservedSectors:Word; FAT12/16 - Usually 1, FAT32 - Usually 32
NumberOfFats:Byte; Usually 2
RootEntryCount:Word; FAT32 always 0, FAT16 usually 512 (RootEntryCount * 32 must be even multiple of BytesPerSector)
TotalSectors16:Word; Total Sectors on the drive or 0 if TotalSectors32 used
MediaId:Byte; F8 for Fixed media, F0 usually for Removable media
SectorsPerFat16:Word; FAT32 always 0, Number of Sectors per FAT
SectorsPerTrack:Word; Sectors Per Track for Int13
NumberOfHeads:Word; Number of Header for Int13 eg 1.44MB = 2
HiddenSectors:LongWord; Number of Hidden Sectors preceeding Partition (Only valid on Partitioned media)
TotalSectors32:LongWord; Total Sectors on the drive or 0 if TotalSectors16 used

FAT32 BIOS parameter block

TExtBiosPB = packed record

BytesPerSector:Word; 512,1024,2048,4096 - Usually 512
SectorsPerCluster:Byte; 1,2,4,8,16,32,64,128
ReservedSectors:Word; FAT12/16 - Usually 1, FAT32 - Usually 32
NumberOfFats:Byte; Usually 2
RootEntryCount:Word; FAT32 always 0, FAT16 usually 512 (RootEntryCount * 32 must be even multiple of BytesPerSector)
TotalSectors16:Word; Total Sectors on the drive or 0 if TotalSectors32 used
MediaId:Byte; F8 for Fixed media, F0 usually for Removable media
SectorsPerFat16:Word; FAT32 always 0, Number of Sectors per FAT
SectorsPerTrack:Word; Sectors Per Track for Int13
NumberOfHeads:Word; Number of Header for Int13 eg 1.44MB = 2
HiddenSectors:LongWord; Number of Hidden Sectors preceeding Partition (Only valid on Partitioned media)
TotalSectors32:LongWord; Total Sectors on the drive or 0 if TotalSectors16 used
SectorsPerFat32:LongWord; Number of Sectors per FAT
ExtendedFlags:Word; Bits 0-3 -- Zero-based number of active FAT. Only valid if mirroring.

Bits 0-3 - is disabled.

Bits 4-6 - Reserved.

Bit 7 - 0 means the FAT is mirrored at runtime into all FATs.

Bit 7 - 1 means only one FAT is active, it is the one referenced.

Bit 7 - in bits 0-3.

Bits 8-15 -- Reserved.

FileSysVersion:Word; FAT32 Version (Current 0:0)
RootCluster:LongWord; Usually Cluster 2
FileSysInfoSector:Word; Usually 1
BackupBootSector:Word; Usually 6
Reserved:array[0..11] of Byte; Always 0

NTFS BIOS parameter block

TNtfsBiosPB = packed record

BytesPerSector:Word; 512,1024,2048,4096 - Usually 512
SectorsPerCluster:Byte; 1,2,4,8,16,32,64,128 - Usually 8
ReservedSectors:Word; Must always be 0 on NTFS (Win2K Volume Manager ?)
Reserved1:array[0..2] of Byte; Must always be 0 on NTFS
Reserved2:Word; Must always be 0 on NTFS
MediaId:Byte; F8 for Fixed media, F0 usually for Removable media
Reserved3:Word; Must always be 0 on NTFS
SectorsPerTrack:Word; Sectors Per Track for Int13
NumberOfHeads:Word; Number of Header for Int13 eg 1.44MB = 2
HiddenSectors:LongWord; Number of Hidden Sectors preceeding Partition
Reserved4:LongWord; Must always be 0 on NTFS
Reserved5:LongWord; Not used by NTFS - Usually 80008000
TotalSectors:Int64; Total Sectors on the drive
MFTCluster:Int64; Start Cluster of $MFT
MFTMirror:Int64; Start Cluster of $MFTMirr
ClustersPerFile:LongInt; Clusters Per File Record (Can be negative) (F6 = 1024 - See Notes)
ClustersPerIndex:LongInt; Clusters Per Index Record (Can be negative) (F6 = 1024 - See Notes)
VolumeSerial:Int64; Volume Serial Number
Checksum:LongWord; Checksum (Not Used)

Partition entry

TPartitionEntry = packed record

BootIndicator:Byte; 80 for active partition
StartHead:Byte; Either Bits 0-3 only or Bits 0-7 depending on BIOS
StartSector:Byte; Bits 0-5 = Sector, Bits 6-7 = Bits 8-9 of Cylinder
StartCylinder:Byte; Bits 0-7 Only, Bits 8-9 in Sector
TypeIndicator:Byte; See Table in Interrupt List and Below
EndHead:Byte; Either Bits 0-3 only or Bits 0-7 depending on BIOS
EndSector:Byte; Bits 0-5 = Sector, Bits 6-7 = Bits 8-9 of Cylinder
EndCylinder:Byte; Bits 0-7 Only, Bits 8-9 in Sector
SectorOffset:LongWord; Offset in sectors from current position to Start of Partition
SectorCount:LongWord; Size in Sectors of the Partition

Partition table

TPartitionTable = packed record

PartitionEntry:array[MIN_PARTITION..MAX_PARTITION] of TPartitionEntry;  

Master boot code

TMasterBootCode = packed array[0..445] of Byte;

Master boot record

PMasterBootRecord = ^TMasterBootRecord;

TMasterBootRecord = packed record

Note: Standard Master Boot Record
BootCode:TMasterBootCode;  
PartitionTable:TPartitionTable;  
Signature:Word; Magic Number $AA55

Ext master boot code

TExtMasterBootCode = packed array[0..439] of Byte;

Ext master boot record

PExtMasterBootRecord = ^TExtMasterBootRecord;

TExtMasterBootRecord = packed record

Note: NT/2000/XP Master Boot Record
BootCode:TExtMasterBootCode;  
DiskSignature:LongWord;  
Reserved1:Word;  
PartitionTable:TPartitionTable;  
Signature:Word; Magic Number $AA55

Partition record

PPartitionRecord = ^TPartitionRecord;

TPartitionRecord = packed record

Note: Similar to TMasterBootRecord
Dummy:array[0..445] of Byte;  
PartitionTable:TPartitionTable; Only first 2 ever used
Signature:Word; Magic Number $AA55

Sector

PSector = ^TSector;

TSector = packed array[0..511] of Byte;

   

Boot sector jump

TBootSectorJump = packed array[0..2] of Byte;

Boot sector code

TBootSectorCode = packed array[0..447] of Byte;

Boot sector

PBootSector = ^TBootSector;

TBootSector = packed record

Note: FAT12/FAT16 Boot Sector
BootJump:TBootSectorJump; JMP - EBh,??h,90h or E9h,??h,??h
OEMName:array[0..7] of Char; MSWIN4.0/MSWIN4.1/MSDOS5.0
BPB:TBiosPB; See Above
DriveNumber:Byte; BIOS Int13 Drive No 00h, 80h, FFh etc
Reserved1:Byte; Always 00h
BootSignature:Byte; Always 29h
VolumeSerial:LongWord; Serial No (Date/Time when Formatted)
VolumeName:array[0..10] of Char; Volume Label or "NO NAME"
SystemName:array[0..7] of Char; System Type FAT12, FAT16, FAT32 etc
BootCode:TBootSectorCode; Executable Code
Signature:Word; Magic Number $AA55

Ext boot sector jump

TExtBootSectorJump = packed array[0..2] of Byte;

Ext boot sector code

TExtBootSectorCode = packed array[0..419] of Byte;

Ext boot sector

PExtBootSector = ^TExtBootSector;

TExtBootSector = packed record

Note: FAT32 Boot Sector
BootJump:TExtBootSectorJump; JMP - EBh,??h,90h or E9h,??h,??h
OEMName:array[0..7] of Char; MSWIN4.1
BPB:TExtBiosPB; See Above
DriveNumber:Byte; BIOS Int13 Drive No 00h, 80h, FFh etc
Reserved1:Byte; Always 00h
BootSignature:Byte; Always 29h
VolumeSerial:LongWord; Serial No (Date/Time when Formatted)
VolumeName:array[0..10] of Char; Volume Label or "NO NAME"
SystemName:array[0..7] of Char; System Type FAT12, FAT16, FAT32 etc
BootCode:TExtBootSectorCode; Executable Code
Signature:Word; Magic Number $AA55

NTFS boot sector jump

TNtfsBootSectorJump = packed array[0..2] of Byte;

NTFS boot sector code

TNtfsBootSectorCode = packed array[0..425] of Byte;

NTFS boot sector

PNtfsBootSector = ^TNtfsBootSector;

TNtfsBootSector = packed record

Note: NTFS Boot Sector
BootJump:TNtfsBootSectorJump; JMP - EBh,??h,90h
OEMName:array[0..7] of Char; Always NTFS
BPB:TNtfsBiosPB; See Above (73 Bytes BPB and ExtBPB)
BootCode:TNtfsBootSectorCode; Executable Code
Signature:Word; Magic Number $AA55

EXTFS boot sector

PExtfsBootSector = ^TExtfsBootSector;

TExtfsBootSector = packed record

Note: EXTFS Boot Sector
   

FileSystem logging

PFileSysLogging = ^TFileSysLogging;

TFileSysLogging = record

Logging Properties
Logging:TLoggingDevice;  


Class definitions



File system driver

TFileSysDriver = class(TObject)

constructor Create;  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
 
FCache:THashCache;  
FImages:TFileSysList;  
FDrives:TFileSysList;  
FVolumes:TFileSysList;  
FDevices:TFileSysList;  
FPartitions:TFileSysList;  
 
FControllers:TFileSysList;  
FRecognizers:TFileSysList;  
FRedirectors:TFileSysList;  
FFileSystems:TFileSysList;  
 
FRawHandles:TFileSysList;  
FEnumHandles:TFileSysList;  
FFileHandles:TFileSysList;  
FFindHandles:TFileSysList;  
 
FCurrentIndex:LongWord; TLS Index for storing current drive
 
FAllowFloppy:Boolean; Allow Scanning of Floppy Devices
FAllowDrives:Boolean; Allow Disk Drives to represent Volumes by drive letter
FOemConvert:Boolean; Convert OEM character strings to ANSI
 
FEntryTimer:TEntryTimer;  
 
FDefaultRecognizer:TRecognizer;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function GetCurrent:TDiskDrive;  
function SetCurrent(ACurrent:TDiskDrive):Boolean;  
 
function FindMatchingFile(ADrive:TDiskDrive; AVolume:TDiskVolume; var ASearchRec:TSearchRec):Integer;  
public
property Cache:THashCache read FCache;  
 
property AllowFloppy:Boolean read FAllowFloppy write FAllowFloppy;  
property AllowDrives:Boolean read FAllowDrives write FAllowDrives;  
property OemConvert:Boolean read FOemConvert write FOemConvert;  
 
function OpenCache(ACacheSize,ACacheKeys,APageSize:LongWord; ACacheMode:TCacheMode):Boolean;  
function CloseCache:Boolean;  
function FlushCache(AAll:Boolean):Boolean;  
function DiscardCache(AAll:Boolean):Boolean;  
function GetCacheStatistics(var AStatistics:TCacheStatistics):Boolean;  
 
function GetCatalogByNo(const APath:String; ACatalogNo:LongWord; ALock:Boolean; AState:LongWord):TDiskCatalog;  
function GetCatalogByName(const APath,AName:String; ALock:Boolean; AState:LongWord):TDiskCatalog;  
function GetCatalogByNext(const APath:String; APrevious:TDiskCatalog; ALock,AUnlock:Boolean; AState:LongWord):TDiskCatalog;  
 
function AddImage(AImage:TDiskImage):Boolean;  
function RemoveImage(AImage:TDiskImage):Boolean;  
function CheckImage(AImage:TDiskImage; ALock:Boolean; AState:LongWord):Boolean;  
 
function GetImageByNo(AImageNo:Integer; ALock:Boolean; AState:LongWord):TDiskImage;  
function GetImageByName(const AName:String; ALock:Boolean; AState:LongWord):TDiskImage;  
function GetImageByDevice(ADevice:TDiskDevice; ALock:Boolean; AState:LongWord):TDiskImage;  
function GetImageByController(AController:TDiskController; ALock:Boolean; AState:LongWord):TDiskImage;  
function GetImagesByController(AController:TDiskController; ALock:Boolean; AState:LongWord):TList;  
function GetImageByNext(APrevious:TDiskImage; ALock,AUnlock:Boolean; AState:LongWord):TDiskImage;  
 
function GetNextImageNo:Integer;  
function GetMaxImageNo:Integer;  
 
function AddDrive(ADrive:TDiskDrive):Boolean;  
function RemoveDrive(ADrive:TDiskDrive):Boolean;  
function CheckDrive(ADrive:TDiskDrive; ALock:Boolean; AState:LongWord):Boolean;  
 
function GetDriveByNo(ADriveNo:Integer; ALock:Boolean; AState:LongWord):TDiskDrive;  
function GetDriveByName(const AName:String; ALock:Boolean; AState:LongWord):TDiskDrive;  
function GetDriveByParent(const AParent:String; ALock:Boolean; AState:LongWord):TDiskDrive;  
function GetDriveByVolume(AVolume:TDiskVolume; ALock:Boolean; AState:LongWord):TDiskDrive;  
function GetDriveByDevice(ADevice:TDiskDevice; ALock:Boolean; AState:LongWord):TDiskDrive;  
function GetDrivesByDevice(ADevice:TDiskDevice; ALock:Boolean; AState:LongWord):TList;  
function GetDriveByPartition(APartition:TDiskPartition; ALock:Boolean; AState:LongWord):TDiskDrive;  
function GetDrivesByPartition(APartition:TDiskPartition; ALock:Boolean; AState:LongWord):TList;  
function GetDriveByNext(APrevious:TDiskDrive; ALock,AUnlock:Boolean; AState:LongWord):TDiskDrive;  
 
function GetNextDriveNo(AMediaType:TMediaType):Integer;  
function GetMaxDriveNo(AMediaType:TMediaType):Integer;  
 
function AddVolume(AVolume:TDiskVolume):Boolean;  
function RemoveVolume(AVolume:TDiskVolume):Boolean;  
function CheckVolume(AVolume:TDiskVolume; ALock:Boolean; AState:LongWord):Boolean;  
 
function GetVolumeByNo(AVolumeNo:Integer; ALock:Boolean; AState:LongWord):TDiskVolume;  
function GetVolumeByName(const AName:String; ALock:Boolean; AState:LongWord):TDiskVolume;  
function GetVolumeByParent(const AParent:String; ALock:Boolean; AState:LongWord):TDiskVolume;  
function GetVolumeByDevice(ADevice:TDiskDevice; ALock:Boolean; AState:LongWord):TDiskVolume;  
function GetVolumesByDevice(ADevice:TDiskDevice; ALock:Boolean; AState:LongWord):TList;  
function GetVolumeByPartition(APartition:TDiskPartition; ALock:Boolean; AState:LongWord):TDiskVolume;  
function GetVolumesByPartition(APartition:TDiskPartition; ALock:Boolean; AState:LongWord):TList;  
function GetVolumeByNext(APrevious:TDiskVolume; ALock,AUnlock:Boolean; AState:LongWord):TDiskVolume;  
 
function GetNextVolumeNo:Integer;  
function GetMaxVolumeNo:Integer;  
 
function AddDevice(ADevice:TDiskDevice):Boolean;  
function RemoveDevice(ADevice:TDiskDevice):Boolean;  
function CheckDevice(ADevice:TDiskDevice; ALock:Boolean; AState:LongWord):Boolean;  
 
function GetDeviceByNo(ADeviceNo:Integer; ALock:Boolean; AState:LongWord):TDiskDevice;  
function GetDeviceByName(const AName:String; ALock:Boolean; AState:LongWord):TDiskDevice;  
function GetDeviceByImage(AImage:TDiskImage; ALock:Boolean; AState:LongWord):TDiskDevice;  
function GetDeviceByStorage(AStorage:PStorageDevice; ALock:Boolean; AState:LongWord):TDiskDevice;  
function GetDeviceByController(AController:TDiskController; ALock:Boolean; AState:LongWord):TDiskDevice;  
function GetDevicesByController(AController:TDiskController; ALock:Boolean; AState:LongWord):TList;  
function GetDeviceByIdentifier(AController:TDiskController; const AIdentifier:String; ALock:Boolean; AState:LongWord):TDiskDevice;  
function GetDeviceByNext(APrevious:TDiskDevice; ALock,AUnlock:Boolean; AState:LongWord):TDiskDevice;  
 
function GetNextDeviceNo(AMediaType:TMediaType):Integer;  
function GetMaxDeviceNo(AMediaType:TMediaType):Integer;  
 
function AddPartition(APartition:TDiskPartition):Boolean;  
function RemovePartition(APartition:TDiskPartition):Boolean;  
function CheckPartition(APartition:TDiskPartition; ALock:Boolean; AState:LongWord):Boolean;  
 
function GetPartitionByNo(ADevice:TDiskDevice; APartitionNo:Integer; AExtended,ALock:Boolean; AState:LongWord):TDiskPartition;  
function GetPartitionByName(ADevice:TDiskDevice; const AName:String; ALock:Boolean; AState:LongWord):TDiskPartition;  
function GetPartitionByPath(const APath:String; ALock:Boolean; AState:LongWord):TDiskPartition;  
function GetPartitionByEntryNo(ADevice:TDiskDevice; APartition:TDiskPartition; AEntryNo:Integer; ALock:Boolean; AState:LongWord):TDiskPartition;  
function GetPartitionByDevice(ADevice:TDiskDevice; ALock:Boolean; AState:LongWord):TDiskPartition;  
function GetPartitionsByDevice(ADevice:TDiskDevice; ALock:Boolean; AState:LongWord):TList;  
function GetPartitionByPartition(APartition:TDiskPartition; ALock:Boolean; AState:LongWord):TDiskPartition;  
function GetPartitionsByPartition(APartition:TDiskPartition; ALock:Boolean; AState:LongWord):TList;  
function GetPartitionByNext(APrevious:TDiskPartition; ALock,AUnlock:Boolean; AState:LongWord):TDiskPartition;  
 
function GetNextPartitionNo(ADevice:TDiskDevice; AExtended:Boolean):Integer;  
function GetMaxPartitionNo(ADevice:TDiskDevice; AExtended:Boolean):Integer;  
 
function AddController(AController:TDiskController):Boolean;  
function RemoveController(AController:TDiskController):Boolean;  
function CheckController(AController:TDiskController; ALock:Boolean; AState:LongWord):Boolean;  
 
function GetControllerByNo(AControllerNo:Integer; ALock:Boolean; AState:LongWord):TDiskController;  
function GetControllerByName(const AName:String; ALock:Boolean; AState:LongWord):TDiskController;  
function GetControllerByNext(APrevious:TDiskController; ALock,AUnlock:Boolean; AState:LongWord):TDiskController;  
 
function GetNextControllerNo:Integer;  
function GetMaxControllerNo:Integer;  
 
function AddRecognizer(ARecognizer:TRecognizer):Boolean;  
function RemoveRecognizer(ARecognizer:TRecognizer):Boolean;  
function CheckRecognizer(ARecognizer:TRecognizer; ALock:Boolean; AState:LongWord):Boolean;  
 
function GetRecognizerByImage(AImage:TDiskImage; ALock:Boolean; AState:LongWord):TRecognizer;  
function GetRecognizerByVolume(AVolume:TDiskVolume; ALock:Boolean; AState:LongWord):TRecognizer;  
function GetRecognizerByPartition(APartition:TDiskPartition; ALock:Boolean; AState:LongWord):TRecognizer;  
function GetRecognizerByPartitionId(APartitionId:Byte; ALock:Boolean; AState:LongWord):TRecognizer;  
function GetRecognizerByBootSector(ABootSector:PBootSector; const AStartSector,ASectorCount:Int64; ALock:Boolean; AState:LongWord):TRecognizer;  
function GetRecognizerByNext(APrevious:TRecognizer; ALock,AUnlock:Boolean; AState:LongWord):TRecognizer;  
 
function AddRedirector(ARedirector:TRedirector):Boolean;  
function RemoveRedirector(ARedirector:TRedirector):Boolean;  
function CheckRedirector(ARedirector:TRedirector; ALock:Boolean; AState:LongWord):Boolean;  
 
function GetRedirectorByPath(const APath:String; ALock:Boolean; AState:LongWord):TRedirector;  
function GetRedirectorByDrive(ADrive:TDiskDrive; ALock:Boolean; AState:LongWord):TRedirector;  
function GetRedirectorByNext(APrevious:TRedirector; ALock,AUnlock:Boolean; AState:LongWord):TRedirector;  
 
function AddFileSystem(AFileSystem:TFileSystem):Boolean;  
function RemoveFileSystem(AFileSystem:TFileSystem):Boolean;  
function CheckFileSystem(AFileSystem:TFileSystem; ALock:Boolean; AState:LongWord):Boolean;  
 
function GetFileSystemByDrive(ADrive:TDiskDrive; ALock:Boolean; AState:LongWord):TFileSystem;  
function GetFileSystemByVolume(AVolume:TDiskVolume; ALock:Boolean; AState:LongWord):TFileSystem;  
function GetFileSystemByRootName(const AName:String; ALock:Boolean; AState:LongWord):TFileSystem;  
function GetFileSystemByRootPath(const APath:String; ALock:Boolean; AState:LongWord):TFileSystem;  
function GetFileSystemByNext(APrevious:TFileSystem; ALock,AUnlock:Boolean; AState:LongWord):TFileSystem;  
 
function LocateDevices:Boolean;  
function LocatePartitions:Boolean;  
function LocateVolumes:Boolean;  
function LocateDrives:Boolean;  
 
function OpenRawHandle(ADevice:TDiskDevice; APartition:TDiskPartition; AVolume:TDiskVolume; ADrive:TDiskDrive; AMode:Integer; ALock:Boolean; AState:LongWord):TRawHandle;  
function CloseRawHandle(AHandle:TRawHandle):Boolean;  
function GetRawHandleByNext(APrevious:TRawHandle; ALock,AUnlock:Boolean; AState:LongWord):TRawHandle;  
 
function ReleaseRawHandles(ADevice:TDiskDevice; APartition:TDiskPartition; AVolume:TDiskVolume; ADrive:TDiskDrive):Boolean;  
 
function OpenEnumHandle(AFileSystem:TFileSystem; ALock:Boolean; AState:LongWord):TEnumHandle;  
function CloseEnumHandle(AHandle:TEnumHandle):Boolean;  
function GetEnumHandleByNext(APrevious:TEnumHandle; ALock,AUnlock:Boolean; AState:LongWord):TEnumHandle;  
 
function UpdateEnumHandles(ADevice:TDiskDevice; APartition:TDiskPartition; ADrive:TDiskDrive; AVolume:TDiskVolume; AImage:TDiskImage; ACatalog:TDiskCatalog):Boolean;  
function ReleaseEnumHandles(AFileSystem:TFileSystem):Boolean;  
 
function OpenFileHandle(AVolume:TDiskVolume; ADrive:TDiskDrive; AParent,AEntry:TDiskEntry; AMode:Integer; ALock:Boolean; AState:LongWord):TFileHandle;  
function CloseFileHandle(AHandle:TFileHandle):Boolean;  
function GetFileHandleByNext(APrevious:TFileHandle; ALock,AUnlock:Boolean; AState:LongWord):TFileHandle;  
 
function CheckFileHandles(AEntry:TDiskEntry):Boolean;  
function ReleaseFileHandles(AVolume:TDiskVolume; ADrive:TDiskDrive):Boolean;  
function DismountFileHandles(AVolume:TDiskVolume; ADrive:TDiskDrive):Boolean;  
 
function OpenFindHandle(AVolume:TDiskVolume; ADrive:TDiskDrive; AParent:TDiskEntry; const AMask:String; AAttr,AFlags:LongWord; ALock:Boolean; AState:LongWord):TFindHandle;  
function CloseFindHandle(AHandle:TFindHandle):Boolean;  
function GetFindHandleByNext(APrevious:TFindHandle; ALock,AUnlock:Boolean; AState:LongWord):TFindHandle;  
 
function UpdateFindHandles(AEntry:TDiskEntry):Boolean;  
function ReleaseFindHandles(AVolume:TDiskVolume; ADrive:TDiskDrive):Boolean;  
function DismountFindHandles(AVolume:TDiskVolume; ADrive:TDiskDrive):Boolean;  
 
function LockMedia(const AName:String):Boolean;  
function UnlockMedia(const AName:String):Boolean;  
function EjectMedia(const AName:String):Boolean;  
 
function MediaReady(const AName:String):Boolean;  
function MediaChanged(const AName:String):Boolean;  
function MediaLocked(const AName:String):Boolean;  
 
function InsertDevice(const AName:String):Boolean;  
function EjectDevice(const AName:String):Boolean;  
 
function OpenDevice(const AName:String; AMode:Integer):Integer;  
procedure CloseDevice(AHandle:Integer);  
function ReadDevice(AHandle:Integer; var ABuffer; ACount:Integer):Integer;  
function WriteDevice(AHandle:Integer; const ABuffer; ACount:Integer):Integer;  
function EraseDevice(AHandle:Integer; ACount:Integer):Integer;  
function SeekDevice(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64;  
 
function FindFirstDevice(var ASearchRec:TDiskSearchRec; AVerbose:Boolean):Integer;  
function FindNextDevice(var ASearchRec:TDiskSearchRec):Integer;  
procedure FindDeviceClose(var ASearchRec:TDiskSearchRec);  
 
function CreatePartition(const ADevice,AParent:String; APartitionId:Byte; ACount:LongWord; AActive:Boolean):Boolean;  
function DeletePartition(const APath:String):Boolean;  
function ModifyPartition(const APath:String; APartitionId:Byte):Boolean;  
function ActivatePartition(const APath:String; AActive:Boolean):Boolean;  
function ShrinkPartition(const APath:String; const AStart,ASize:Int64):Boolean;  
function ExpandPartition(const APath:String; const AStart,ASize:Int64):Boolean;  
 
function OpenPartition(const APath:String; AMode:Integer):Integer;  
procedure ClosePartition(AHandle:Integer);  
function ReadPartition(AHandle:Integer; var ABuffer; ACount:Integer):Integer;  
function WritePartition(AHandle:Integer; const ABuffer; ACount:Integer):Integer;  
function SeekPartition(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64;  
 
function FindFirstPartition(const ADevice:String; var ASearchRec:TPartitionSearchRec; AVerbose:Boolean):Integer;  
function FindNextPartition(var ASearchRec:TPartitionSearchRec):Integer;  
procedure FindPartitionClose(var ASearchRec:TPartitionSearchRec);  
 
function CreateVolume(const AParent:String; ADriveNo:Integer):Boolean;  
function DeleteVolume(Const AName:String):Boolean;  
function MountVolume(const AName:String; ADriveNo:Integer):Boolean;  
function DismountVolume(const AName:String):Boolean;  
function FormatVolume(const AName:String; AFloppyType:TFloppyType; AFileSysType:TFileSysType):Boolean;  
function DefragmentVolume(const AName:String):Boolean;  
function ConvertVolume(const AName:String; AFileSysType:TFileSysType):Boolean;  
function RepairVolume(const AName:String):Boolean;  
function CopyVolume(const AName,ADest:String):Boolean;  
function ShrinkVolume(const AName:String; const AStart,ASize:Int64):Boolean;  
function ExpandVolume(const AName:String; const AStart,ASize:Int64):Boolean;  
 
function OpenVolume(const AName:String; AMode:Integer):Integer;  
procedure CloseVolume(AHandle:Integer);  
function ReadVolume(AHandle:Integer; var ABuffer; ACount:Integer):Integer;  
function WriteVolume(AHandle:Integer; const ABuffer; ACount:Integer):Integer;  
function SeekVolume(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64;  
 
function FindFirstVolume(var ASearchRec:TVolumeSearchRec; AVerbose:Boolean):Integer;  
function FindNextVolume(var ASearchRec:TVolumeSearchRec):Integer;  
procedure FindVolumeClose(var ASearchRec:TVolumeSearchRec);  
 
function CreateDrive(const AName,AParent:String):Boolean;  
function DeleteDrive(const AName:String):Boolean;  
function FormatDrive(const AName:String; AFloppyType:TFloppyType; AFileSysType:TFileSysType):Boolean;  
 
function OpenDrive(const AName:String; AMode:Integer):Integer;  
procedure CloseDrive(AHandle:Integer);  
function ReadDrive(AHandle:Integer; var ABuffer; ACount:Integer):Integer;  
function WriteDrive(AHandle:Integer; const ABuffer; ACount:Integer):Integer;  
function SeekDrive(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64;  
 
function FindFirstDrive(var ASearchRec:TDriveSearchRec; AVerbose:Boolean):Integer;  
function FindNextDrive(var ASearchRec:TDriveSearchRec):Integer;  
procedure FindDriveClose(var ASearchRec:TDriveSearchRec);  
 
function MountImage(AImageNo:Integer):Boolean;  
function DismountImage(AImageNo:Integer):Boolean;  
function InsertImage(AImageNo:Integer):Boolean;  
function EjectImage(AImageNo:Integer):Boolean;  
function ConvertImage(AImageNo:Integer; AImageType:TImageType):Boolean;  
function CopyImage(AImageNo,ADestNo:Integer):Boolean;  
function ShrinkImage(AImageNo:Integer; const ASize:Int64):Boolean;  
function ExpandImage(AImageNo:Integer; const ASize:Int64):Boolean;  
 
function CreateImage(AImageNo:Integer; const AName:String; AImageType:TImageType; AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer;  
function OpenImage(AImageNo:Integer;const AName:String; AImageType:TImageType; AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer;  
function CloseImage(AImageNo:Integer):Boolean;  
 
function CreateSnapshot(AImageNo:Integer):Boolean;  
function DeleteSnapshot(AImageNo:Integer):Boolean;  
function MergeSnapshot(AImageNo:Integer):Boolean;  
 
function FindFirstImage(var ASearchRec:TImageSearchRec; AVerbose:Boolean):Integer;  
function FindNextImage(var ASearchRec:TImageSearchRec):Integer;  
procedure FindImageClose(var ASearchRec:TImageSearchRec);  
 
function CreateCatalog(const APath,AName:String; AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64):LongWord;  
function DeleteCatalog(const APath:String; ACatalogNo:LongWord):Boolean;  
 
function FindFirstCatalog(const APath:String; var ASearchRec:TCatalogSearchRec):Integer;  
function FindNextCatalog(var ASearchRec:TCatalogSearchRec):Integer;  
procedure FindCatalogClose(var ASearchRec:TCatalogSearchRec);  
 
function CheckTimer:Boolean;  
function ProcessTimer:Boolean;  
 
function ScheduleEntry(AEntry:TDiskEntry; ATimeout:LongWord):Boolean;  
function UnscheduleEntry(AEntry:TDiskEntry):Boolean;  
 
function GetPathDrive(const APath:String):Byte;  
function GetDriveType(ADrive:Byte):TDriveType;  
function GetDriveData(ADrive:Byte):TDriveData;  
function GetDriveAttr(ADrive:Byte):LongWord;  
function GetDriveLabel(ADrive:Byte):String;  
function SetDriveLabel(ADrive:Byte; const ALabel:String):Boolean;  
function GetDriveSerial(ADrive:Byte):LongWord;  
function SetDriveSerial(ADrive:Byte; ASerial:LongWord):Boolean;  
function IsDriveValid(ADrive:Byte):Boolean;  
function GetValidDrives:LongWord;  
function GetValidDriveNames:TStringList;  
function GetValidDriveStrings:String;  
function GetDriveFreeSpace(ADrive:Byte):LongWord;  
function GetDriveFreeSpaceEx(ADrive:Byte):Int64;  
function GetDriveTotalSpace(ADrive:Byte):LongWord;  
function GetDriveTotalSpaceEx(ADrive:Byte):Int64;  
 
function GetDriveInformation(const APath:String; var AClusterSize:LongWord; var ATotalClusterCount,AFreeClusterCount:Int64):Boolean;  
 
function GetCurrentDrive:Byte;  
function SetCurrentDrive(const ADrive:String):Boolean;  
 
function GetPathVolume(const APath:String):String;  
function GetVolumeType(const AVolume:String):TDriveType;  
function GetVolumeData(const AVolume:String):TDriveData;  
function GetVolumeAttr(const AVolume:String):LongWord;  
function GetVolumeLabel(const AVolume:String):String;  
function SetVolumeLabel(const AVolume:String; const ALabel:String):Boolean;  
function GetVolumeSerial(const AVolume:String):LongWord;  
function SetVolumeSerial(const AVolume:String; ASerial:LongWord):Boolean;  
function IsVolumeValid(const AVolume:String):Boolean;  
function GetValidVolumeNames:TStringList;  
function GetVolumeFreeSpace(const AVolume:String):LongWord;  
function GetVolumeFreeSpaceEx(const AVolume:String):Int64;  
function GetVolumeTotalSpace(const AVolume:String):LongWord;  
function GetVolumeTotalSpaceEx(const AVolume:String):Int64;  
 
function FileOpen(const AFileName:String; AMode:Integer):Integer;  
function FileCreate(const AFileName:String):Integer;  
function DeleteFile(const AFileName:String):Boolean;  
procedure FileClose(AHandle:Integer);  
function RenameFile(const AOldName,ANewName:String):Boolean;  
function FileSeek(AHandle,AOffset,AOrigin:Integer):Integer;  
function FileFlush(AHandle:Integer):Boolean;  
function FileTruncate(AHandle:Integer):Boolean;  
function SetEndOfFile(AHandle:Integer):Boolean;  
 
function EndOfFile(AHandle:Integer):Boolean;  
function FilePos(AHandle:Integer):Integer;  
function FileSize(AHandle:Integer):Integer;  
 
function FileAge(const AFileName:String):Integer;  
function FileExists(const AFileName:String):Boolean;  
function FileGetAttr(const AFileName:String):Integer;  
function FileGetDate(AHandle:Integer):Integer;  
function FileSetAttr(const AFileName:String; AAttr:Integer):Integer;  
function FileSetDate(AHandle:Integer; AAge:Integer):Integer;  
 
function FileRead(AHandle:Integer; var ABuffer; ACount:Integer):Integer;  
function FileWrite(AHandle:Integer; const ABuffer; ACount:Integer):Integer;  
 
function CreateDir(const ADirName:String):Boolean;  
function RemoveDir(const ADirName:String):Boolean;  
function RenameDir(const AOldName,ANewName:String):Boolean;  
function GetCurrentDir:String;  
function GetCurrentDirEx(ADrive:Byte):String;  
function SetCurrentDir(const ADirName:String):Boolean;  
function DirectoryExists(const ADirName:String):Boolean;  
procedure ForceDirectories(ADirName:String);  
procedure DeleteTree(const ADirName:String);  
 
function FindFirst(const APath:String; AAttr:Integer; var ASearchRec:TSearchRec):Integer;  
function FindNext(var ASearchRec:TSearchRec):Integer;  
procedure FindClose(var ASearchRec:TSearchRec);  
 
function FindFirstStream(const AFileName:String; var ASearchRec:TStreamSearchRec):Integer;  
function FindNextStream(var ASearchRec:TStreamSearchRec):Integer;  
procedure FindStreamClose(var ASearchRec:TStreamSearchRec);  
 
function FindFirstFileName(const AFileName:String; var ASearchRec:TLinkSearchRec):Integer;  
function FindNextFileName(var ASearchRec:TLinkSearchRec):Integer;  
procedure FindFileNameClose(var ASearchRec:TLinkSearchRec);  
 
function CreateHardLink(const ALinkName,AFileName:String):Boolean;  
function DeleteHardLink(const ALinkName:String):Boolean;  
 
function MountPointExists(const APathName:String):Boolean;  
function CreateMountPoint(const APathName,AVolumeName:String):Boolean;  
function DeleteMountPoint(const APathName:String):Boolean;  
 
function JunctionPointExists(const APathName:String):Boolean;  
function CreateJunctionPoint(const APathName,AFolderName:String):Boolean;  
function DeleteJunctionPoint(const APathName:String):Boolean;  
 
function SymbolicLinkExists(const ALinkName:String):Boolean;  
function CreateSymbolicLink(const ALinkName,ATargetName:String; ADirectory:Boolean):Boolean;  
function CreateSymbolicLinkEx(const ALinkName,AShortName,ATargetName:String; ADirectory:Boolean):Boolean;  
function DeleteSymbolicLink(const ALinkName:String):Boolean;  
 
function GetMountPointTarget(const APathName:String):String;  
function GetJunctionPointTarget(const APathName:String):String;  
function GetSymbolicLinkTarget(const ALinkName:String):String;  
 
function SetFileShortName(const AFileName,AShortName:String):Boolean;  
function SetFileShortNameEx(AHandle:Integer; const AShortName:String):Boolean;  
 
function GetFileSecurity(const AFileName:String; ADescriptor:Pointer; var ASize:LongWord):Boolean;  
function SetFileSecurity(const AFileName:String; ADescriptor:Pointer):Boolean;  
 
function FileCopy(const ASourceFile,ADestFile:String; AFailIfExists:Boolean):Boolean;  
function FileCopyEx(const ASourceFile,ADestFile:String; AFailIfExists:Boolean; AUseSourceDate:Boolean; ADestDate:Integer; AUseSourceAttr:Boolean; ADestAttr:Integer):Boolean;  
 
function FileMove(const ASourceFile,ADestFile:String; AFailIfExists:Boolean):Boolean;  
function FileMoveEx(const ASourceFile,ADestFile:String; AFailIfExists:Boolean; AUseSourceDate:Boolean; ADestDate:Integer; AUseSourceAttr:Boolean; ADestAttr:Integer):Boolean;  
 
function GetPathName(const AFileName:String):String;  
 
function GetShortName(const AFileName:String):String;  
function GetLongName(const AFileName:String):String;  
function GetTrueName(const AFileName:String):String;  
 
function AddSlash(const AFilePath:String; ALeading,ATrailing:Boolean):String;  
function DeleteSlash(const AFilePath:String; ALeading,ATrailing:Boolean):String;  
 
function FileCreateEx(const AFileName,AShortName:String):Integer;  
function CreateDirEx(const ADirName,AShortName:String):Boolean;  
 
function FileSeekEx(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64;  
 
function EndOfFileEx(AHandle:Integer):Boolean;  
function FilePosEx(AHandle:Integer):Int64;  
function FileSizeEx(AHandle:Integer):Int64;  
 
function FileAgeEx(const AFileName:String):TFileTime;  
 
function FileGetAttrEx(AHandle:Integer):Integer;  
 
function FileGetDateEx(AHandle:Integer):TFileTime;  
function FileSetDateEx(AHandle:Integer ;AAge:TFileTime):Integer;  
 
function GetFileTime(AHandle:Integer; ACreateTime,AAccessTime,AWriteTime:PFileTime):Boolean;  
function SetFileTime(AHandle:Integer; ACreateTime,AAccessTime,AWriteTime:PFileTime):Boolean;  
 
function FindOne(const APath:String; var ASearchRec:TFileSearchRec):Integer;  
function FindAll(const APath:String; var ASearchRec:TFileSearchRec):Integer;  
 
function FindFirstEx(const APath:String; var ASearchRec:TFileSearchRec):Integer;  
function FindNextEx(var ASearchRec:TFileSearchRec):Integer;  
procedure FindCloseEx(var ASearchRec:TFileSearchRec);  
 
function DefineDosDevice(const ADeviceName,ATargetPath:String; AFlags:LongWord):Boolean;  
function GetDiskType(const ARootPath:String):LongWord; Equivalent to Win32 GetDriveType
function GetDiskFreeSpace(const ARootPath:String; var ASectorsPerCluster,ABytesPerSector,ANumberOfFreeClusters,ATotalNumberOfClusters:LongWord):Boolean;  
function GetDiskFreeSpaceEx(const APathName:String; var AFreeBytesAvailableToCaller,ATotalNumberOfBytes,ATotalNumberOfFreeBytes:Int64):Boolean;  
function GetLogicalDrives:LongWord;  
function GetLogicalDriveStrings:String;  
function GetVolumeInformation(const ARootPath:String; var AVolumeName:String; var AVolumeSerialNumber,AMaximumComponentLength,AFileSystemFlags:LongWord; var ASystemName:String):Boolean;  
function QueryDosDevice(const ARootPath:String):String;  
function SetVolumeLabel Already Defined
 
function AreFileApisANSI:Boolean;  
function CloseFile(AHandle:THandle):Boolean; Equivalent to Win32 CloseHandle
function CopyFile(const AExistingName,ANewName:String; AFailIfExists:Boolean):Boolean;  
function CreateFile(const AFileName:String; AAccessMode,AShareMode,ACreateFlags,AFileAttributes:LongWord):THandle;  
function DeleteFile Already Defined
function FindCloseFile(AHandle:THandle):Boolean; Equivalent to Win32 FindClose
function FindFirstFile(const AFileName:String; var AFindData:TWin32FindData):THandle;  
function FindNextFile(AHandle:THandle; var AFindData:TWin32FindData):Boolean;  
function FlushFileBuffers(AHandle:THandle):Boolean;  
function GetBinaryType  
function GetFileAttributes(const AFileName:String):LongWord;  
function GetFileInformationByHandle(AHandle:THandle; var AFileInformation:TByHandleFileInformation):Boolean;  
function GetFileSize(AHandle:THandle; var AFileSizeHigh:LongWord):LongWord;  
function GetFileSizeEx Same as FileSizeEx
function GetFileTime Already Defined
function GetFileType  
function GetFullPathName(const AFileName:String):String;  
function GetShortPathName(const ALongPath:String):String;  
function GetTempDrive  
function GetTempFileName  
function GetTempPath  
function LockFile  
function LockFileEx  
function MoveFile(const AExistingName,ANewName:String):Boolean;  
function MoveFileEx  
function ReadFile(AHandle:THandle; var ABuffer; ABytesToRead:LongWord; var ABytesRead:LongWord):Boolean;  
function ReadFileEx  
function SearchPath  
function SetEndOfFile Already Defined
function SetFileApisToANSI:Boolean;  
function SetFileApisToOEM:Boolean;  
function SetFileAttributes(const AFileName:String; AFileAttributes:LongWord):Boolean;  
function SetFilePointer(AHandle:THandle; ADistanceToMove:LongWord; var ADistanceToMoveHigh:LongWord; AMoveMethod:LongWord):LongWord;  
function SetFilePointerEx(AHandle:THandle; const ADistanceToMove:Int64; var ANewFilePointer:Int64; AMoveMethod:LongWord):Boolean;  
function SetFileTime Already Defined
function SetHandleCount  
function UnlockFile  
function UnlockFileEx  
function WriteFile(AHandle:THandle; const ABuffer; ABytesToWrite:LongWord; var ABytesWritten:LongWord):Boolean;  
function WriteFileEx  
function GetLongPathName(const AShortPath:String):String;  
function SetFileShortName Already Defined
 
function CreateDirectory(const APathName:String):Boolean;  
function CreateDirectoryEx  
function GetCurrentDirectory:String;  
function RemoveDirectory(const APathName:String):Boolean;  
function SetCurrentDirectory(const APathName:String):Boolean;  
 
function FindFirstStream Already Defined
function FindNextStream Already Defined
 
function CreateHardlink Already Defined
function FindFirstFileName Already Defined
function FindNextFileName Already Defined
 
function SetVolumeMountPoint  
function DeleteVolumeMountPoint  
function FindFirstVolumeMountPoint  
function FindNextVolumeMountPoint  
function FindVolumeMountPointClose  
 
function CreateSymbolicLink Already Defined
 
function FindFirstVolume Already Defined
function FindNextVolume Already Defined
function FindVolumeClose Already Defined
 
function GetFileSecurity Already Defined
function SetFileSecurity Already Defined
function GetNamedSecurityInfo  
function SetNamedSecurityInfo  
 
function GetDeviceFromRaw(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskDevice;  
function GetDeviceFromEnum(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskDevice;  
 
function GetPartitionFromRaw(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskPartition;  
function GetPartitionFromEnum(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskPartition;  
 
function GetVolumeFromPath(const APath:String; ALock:Boolean; AState:LongWord):TDiskVolume;  
function GetVolumeFromRaw(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskVolume;  
function GetVolumeFromEnum(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskVolume;  
function GetVolumeFromFile(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskVolume;  
function GetVolumeFromFind(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskVolume;  
 
function GetDriveFromPath(const APath:String; ALock:Boolean; AState:LongWord):TDiskDrive;  
function GetDriveFromRaw(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskDrive;  
function GetDriveFromEnum(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskDrive;  
function GetDriveFromFile(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskDrive;  
function GetDriveFromFind(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskDrive;  
 
function GetImageFromEnum(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskImage;  
 
function GetCatalogFromEnum(AHandle:Integer; ALock:Boolean; AState:LongWord):TDiskCatalog;  
 
function GetFileSystemFromPath(const APath:String; ALock:Boolean; AState:LongWord):TFileSystem;  
function GetFileSystemFromEnum(AHandle:Integer; ALock:Boolean; AState:LongWord):TFileSystem;  
function GetFileSystemFromFile(AHandle:Integer; ALock:Boolean; AState:LongWord):TFileSystem;  
function GetFileSystemFromFind(AHandle:Integer; ALock:Boolean; AState:LongWord):TFileSystem;  
 
function GetRawFromHandle(AHandle:Integer; ALock:Boolean; AState:LongWord):TRawHandle;  
function GetEnumFromHandle(AHandle:Integer; ALock:Boolean; AState:LongWord):TEnumHandle;  
function GetFileFromHandle(AHandle:Integer; ALock:Boolean; AState:LongWord):TFileHandle;  
function GetFindFromHandle(AHandle:Integer; ALock:Boolean; AState:LongWord):TFindHandle;  

File system list

TFileSysList = class(TLinkedObjList)

constructor Create;  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
public
procedure ClearList;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  

File system list extended

TFileSysListEx = class(TLinkedObjList)

constructor Create(ALock:TSynchronizerHandle);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
public
procedure ClearList;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  

File system tree

TFileSysTree = class(TLinkedObjTree)

constructor Create;  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
public
procedure ClearList;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  

Disk drive

TDiskDrive = class(TListObject)

constructor Create(ADriver:TFileSysDriver; AVolume:TDiskVolume; ADriveNo:Integer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FVolume:TDiskVolume;  
 
FDriveNo:Integer;  
 
FDriveType:TDriveType;  
 
FFileSystem:TFileSystem;  
 
FRemovable:Boolean; Drive is removable - Set by DriveInit
FRecognizable:Boolean; Drive allows Recognize Drive
FRecognized:Boolean; Recognized Drive - Set by Recognizer
 
FSectorSize:Word; Sector Size of Drive or Device
FStartSector:Int64; Start Sector on Drive or Device
FSectorCount:LongWord; Total Sectors in Drive
FSectorShiftCount:Word; Sectors to Bytes Shift Count
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetName:String;  
function GetRoot:String;  
function GetParent:String;  
 
function GetMaxFile:Integer;  
function GetMaxPath:Integer;  
function GetAttributes:LongWord;  
function GetSystemName:String;  
function GetVolumeName:String;  
function GetVolumeGUID:String;  
function GetVolumeSerial:LongWord;  
 
function GetDriveType:TDriveType;  
function GetFileSysType:TFileSysType;  
 
procedure SetFileSystem(AFileSystem:TFileSystem);  
 
function GetRemovable:Boolean;  
function GetRecognizable:Boolean;  
function GetRecognized:Boolean;  
 
function GetSectorSize:Word;  
function GetStartSector:Int64;  
function GetSectorCount:LongWord;  
function GetSectorShiftCount:Word;  
 
function GetDevice:TDiskDevice;  
function GetPartition:TDiskPartition;  
 
function GetBootRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
function SetBootRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
public
property Name:String read GetName;  
property Root:String read GetRoot;  
property Parent:String read GetParent;  
property Volume:TDiskVolume read FVolume;  
property DriveNo:Integer read FDriveNo;  
 
property MaxFile:Integer read GetMaxFile;  
property MaxPath:Integer read GetMaxPath;  
property Attributes:LongWord read GetAttributes;  
property SystemName:String read GetSystemName;  
property VolumeName:String read GetVolumeName;  
property VolumeGUID:String read GetVolumeGUID;  
property VolumeSerial:LongWord read GetVolumeSerial;  
 
property DriveType:TDriveType read GetDriveType;  
property FileSysType:TFileSysType read GetFileSysType;  
 
property FileSystem:TFileSystem read FFileSystem write SetFileSystem;  
 
property Removable:Boolean read GetRemovable;  
property Recognizable:Boolean read GetRecognizable;  
property Recognized:Boolean read GetRecognized write FRecognized;  
 
property SectorSize:Word read GetSectorSize;  
property StartSector:Int64 read GetStartSector;  
property SectorCount:LongWord read GetSectorCount;  
property SectorShiftCount:Word read GetSectorShiftCount;  
 
property Device:TDiskDevice read GetDevice;  
property Partition:TDiskPartition read GetPartition;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function DriveInit:Boolean; virtual;  

Raw handle

TRawHandle = class(TListObject)

constructor Create;  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
public
Device:TDiskDevice;  
Partition:TDiskPartition;  
Volume:TDiskVolume;  
Drive:TDiskDrive;  
 
OpenMode:Integer;  
ShareMode:Integer;  
 
Size:Int64;  
Position:Int64;  
Handle:Integer;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  

Enumerate handle

TEnumHandle = class(TListObject)

constructor Create;  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
public
FileSystem:TFileSystem;  
 
Handle:Integer;  
 
CurrentDevice:TDiskDevice;  
CurrentPartition:TDiskPartition;  
CurrentDrive:TDiskDrive;  
CurrentVolume:TDiskVolume;  
CurrentImage:TDiskImage;  
CurrentCatalog:TDiskCatalog;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  

File handle

TFileHandle = class(TListObject)

constructor Create;  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
public
Volume:TDiskVolume;  
Drive:TDiskDrive;  
 
OpenMode:Integer;  
ShareMode:Integer;  
 
Position:Int64;  
Handle:Integer;  
 
DataValue:LongWord; Available to FileSystem for private use
DataOffset:LongWord; Available to FileSystem for private use
 
ParentEntry:TDiskEntry;  
HandleEntry:TDiskEntry;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  

Find handle

TFindHandle = class(TListObject)

constructor Create;  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
public
Volume:TDiskVolume;  
Drive:TDiskDrive;  
 
Any:Boolean;  
Mask:String;  
Attr:LongWord;  
Flags:LongWord;  
Handle:Integer;  
 
ParentEntry:TDiskEntry;  
CurrentEntry:TDiskEntry;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  

Disk controller

TDiskController = class(TListObject)

constructor Create(ADriver:TFileSysDriver);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
 
FControllerNo:Integer; \Controller0, \Controller1 etc - See Notes
FDescription:String; Description of Controller - eg "Standard ATA Controller"
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetName:String;  
function GetDescription:String;  
function GetFixedDiskCount:Integer; virtual;  
function GetFloppyDiskCount:Integer; virtual;  
function LCHStoLBA(ADevice:TDiskDevice; Cylinder,Head,Sector:Word; var LBA:LongWord):Boolean;  
function PCHStoLBA(ADevice:TDiskDevice; Cylinder,Head,Sector:LongWord; var LBA:LongWord):Boolean;  
function LBAtoLCHS(ADevice:TDiskDevice; LBA:LongWord; var Cylinder,Head,Sector:Word):Boolean;  
function LBAtoPCHS(ADevice:TDiskDevice; LBA:LongWord; var Cylinder,Head,Sector:LongWord):Boolean;  
function LCHStoPCHS(ADevice:TDiskDevice; LCylinder,LHead,LSector:Word; var PCylinder,PHead,PSector:LongWord):Boolean;  
function PCHStoLCHS(ADevice:TDiskDevice; PCylinder,PHead,PSector:LongWord; var LCylinder,LHead,LSector:Word):Boolean;  
public
property Name:String read GetName;  
property ControllerNo:Integer read FControllerNo;  
property Description:String read GetDescription;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  
 
function ControllerInit:Boolean; virtual;  
 
function LocateDevices:Boolean; virtual;  
 
function Read(ADevice:TDiskDevice; ASector:LongWord; ACount:Word; var ABuffer):Boolean; virtual;  
function Write(ADevice:TDiskDevice; ASector:LongWord; ACount:Word; const ABuffer):Boolean; virtual;  
function Erase(ADevice:TDiskDevice; ASector:LongWord; ACount:Word):Boolean; virtual;  
 
function Reset(ADevice:TDiskDevice):Boolean; virtual;  
 
function LockMedia(ADevice:TDiskDevice):Boolean; virtual;  
function UnlockMedia(ADevice:TDiskDevice):Boolean; virtual;  
function EjectMedia(ADevice:TDiskDevice):Boolean; virtual;  
 
function MediaReady(ADevice:TDiskDevice):Boolean; virtual;  
function MediaChanged(ADevice:TDiskDevice):Boolean; virtual;  
function MediaLocked(ADevice:TDiskDevice):Boolean; virtual;  
 
function Information(ADevice:TDiskDevice):String; virtual;  
 
function VendorId(ADevice:TDiskDevice):Word; virtual;  
function DeviceId(ADevice:TDiskDevice):Word; virtual;  
 
function Manufacturer(ADevice:TDiskDevice):String; virtual;  
function Product(ADevice:TDiskDevice):String; virtual;  
function SerialNumber(ADevice:TDiskDevice):String; virtual;  
 
function HostBus(ADevice:TDiskDevice):String; virtual;  
function BusNumber(ADevice:TDiskDevice):Word; virtual;  
function DeviceNumber(ADevice:TDiskDevice):Word; virtual;  
function FunctionNumber(ADevice:TDiskDevice):Word; virtual;  
function BaseAddress(ADevice:TDiskDevice):Word; virtual;  
function InterfaceType(ADevice:TDiskDevice):String; virtual;  
 
function Slave(ADevice:TDiskDevice):Boolean; virtual;  
function LogicalUnitNo(ADevice:TDiskDevice):LongWord; virtual;  
function FireWireGUID(ADevice:TDiskDevice):Int64; virtual;  
function WorldWideNo(ADevice:TDiskDevice):Int64; virtual;  
 
function PhysicalPort(ADevice:TDiskDevice):Word; virtual;  
function ControlPort(ADevice:TDiskDevice):Word; virtual;  
function IRQ(ADevice:TDiskDevice):LongWord; virtual;  
 
function PIO(ADevice:TDiskDevice):Boolean; virtual;  
function DMA(ADevice:TDiskDevice):Boolean; virtual;  
function LBA(ADevice:TDiskDevice):Boolean; virtual;  
function Version(ADevice:TDiskDevice):LongWord; virtual;  
 
function MediaType(ADevice:TDiskDevice):TMediaType; virtual;  
function FloppyType(ADevice:TDiskDevice):TFloppyType; virtual;  
function Ready(ADevice:TDiskDevice):Boolean; virtual;  
function Locked(ADevice:TDiskDevice):Boolean; virtual;  
function Lockable(ADevice:TDiskDevice):Boolean; virtual;  
function Ejectable(ADevice:TDiskDevice):Boolean; virtual;  
function Readable(ADevice:TDiskDevice):Boolean; virtual;  
function Writeable(ADevice:TDiskDevice):Boolean; virtual;  
function Eraseable(ADevice:TDiskDevice):Boolean; virtual;  
function Removable(ADevice:TDiskDevice):Boolean; virtual;  
function ChangeLine(ADevice:TDiskDevice):Boolean; virtual;  
 
function PhysicalCylinders(ADevice:TDiskDevice):LongWord; virtual;  
function PhysicalHeads(ADevice:TDiskDevice):LongWord; virtual;  
function PhysicalSectors(ADevice:TDiskDevice):LongWord; virtual;  
 
function LogicalCylinders(ADevice:TDiskDevice):LongWord; virtual;  
function LogicalHeads(ADevice:TDiskDevice):LongWord; virtual;  
function LogicalSectors(ADevice:TDiskDevice):LongWord; virtual;  
 
function SectorSize(ADevice:TDiskDevice):Word; virtual;  
function SectorCount(ADevice:TDiskDevice):Int64; virtual;  
function SectorShiftCount(ADevice:TDiskDevice):Word; virtual;  

Disk device

TDiskDevice = class(TListObject)

constructor Create(ADriver:TFileSysDriver; AController:TDiskController; AImage:TDiskImage; AStorage:PStorageDevice; ADeviceNo:Integer; const AIdentifier:String);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FController:TDiskController;  
FImage:TDiskImage;  
FStorage:PStorageDevice;  
 
FDeviceNo:Integer; 00h, 01h, 80h, 81h etc - See Notes
FIdentifier:String; Controller Specific Identifier
FInformation:String; Description of Device - eg "Standard ATA Disk"
 
FVendorId:Word; PCI or USB Vendor Id
FDeviceId:Word; PCI or USB Device Id
 
FManufacturer:String; Device Manufacturer name
FProduct:String; Device Product name
FSerialNumber:String; Device Serial Number
 
FHostBus:String; PCI, ISA etc
FBusNumber:Word; PCI Bus No
FDeviceNumber:Word; PCI Device No
FFunctionNumber:Word; PCI Function No
FBaseAddress:Word; ISA Base Address
FInterfaceType:String; ATA, ATAPI, SCSI, USB, 1394, FIBRE
 
FSlave:Boolean; Device is Slave
FLogicalUnitNo:LongWord; LUN No eg SCSI, ATAPI or USB
FFireWireGUID:Int64; FireWire GUID No
FWorldWideNo:Int64; Fibre Channel WWN
 
FPhysicalPort:Word; Physical IO Port
FControlPort:Word; Drive Control Port
FIRQ:LongWord; IRQ No
 
FPIO:Boolean; PIO Transfer Enabled
FDMA:Boolean; DMA Transfer Enabled
FLBA:Boolean; Supports LBA (eg Int13 Extensions)
FVersion:LongWord; Version Information (eg Int13 Extensions Version 01h,20h,21h,30h)
 
FMediaType:TMediaType; Media Type eg Fixed, Removable, Floppy
FFloppyType:TFloppyType; Floppy Type eg 360K, 1.44M, ATAPI
FReady:Boolean; Media is Inserted in Drive
FLocked:Boolean; Media is Locked in Drive
FLockable:Boolean; Media is Lockable
FEjectable:Boolean; Media is Ejectable
FReadable:Boolean; Media is Readable
FWriteable:Boolean; Media is Writeable
FEraseable:Boolean; Media is Eraseable
FRemovable:Boolean; Media is Removable
FChangeLine:Boolean; Supports ChangeLine detection
 
FPhysicalCylinders:LongWord; Physical Cylinders on Drive
FPhysicalHeads:LongWord; Physical Heads on Drive
FPhysicalSectors:LongWord; Physical Sectors per Track
 
FLogicalCylinders:LongWord; Logical Cylinders on Drive
FLogicalHeads:LongWord; Logical Heads on Drive
FLogicalSectors:LongWord; Logical Sectors per Track
 
FSectorSize:Word; Bytes Per Sector
FSectorCount:Int64; Total Sectors
FSectorShiftCount:Word; Sectors to Bytes Shift Count
 
FPageCount:Word; Cache Page Count for this Device
FPageShift:Word; Cache Page Shift for this Device
FPageMask:LongWord; Cache Page Mask for this Device
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetName:String;  
 
function GetIdentifier:String;  
function GetInformation:String;  
 
function GetManufacturer:String;  
function GetProduct:String;  
function GetSerialNumber:String;  
 
function GetHostBus:String;  
function GetInterfaceType:String;  
 
function GetFreeSectors:Int64; Unused Sectors on Device
function GetAvailableSectors:Int64; Largest block of Unused Sectors
 
function GetAvailableBlock(var AStart,ACount:Int64):Boolean;  
 
function GetDiskSignature:LongWord; virtual;  
procedure SetDiskSignature(ADiskSignature:LongWord); virtual;  
 
function GetBootRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
function SetBootRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
public
property Name:String read GetName;  
property Controller:TDiskController read FController;  
property Image:TDiskImage read FImage;  
property Storage:PStorageDevice read FStorage;  
 
property DeviceNo:Integer read FDeviceNo;  
property Identifier:String read GetIdentifier;  
property Information:String read GetInformation;  
 
property VendorId:Word read FVendorId;  
property DeviceId:Word read FDeviceId;  
 
property Manufacturer:String read GetManufacturer;  
property Product:String read GetProduct;  
property SerialNumber:String read GetSerialNumber;  
 
property HostBus:String read GetHostBus;  
property BusNumber:Word read FBusNumber;  
property DeviceNumber:Word read FDeviceNumber;  
property FunctionNumber:Word read FFunctionNumber;  
property BaseAddress:Word read FBaseAddress;  
property InterfaceType:String read GetInterfaceType;  
 
property Slave:Boolean read FSlave;  
property LogicalUnitNo:LongWord read FLogicalUnitNo;  
property FireWireGUID:Int64 read FFireWireGUID;  
property WorldWideNo:Int64 read FWorldWideNo;  
 
property PhysicalPort:Word read FPhysicalPort;  
property ControlPort:Word read FControlPort;  
property IRQ:LongWord read FIRQ;  
 
property PIO:Boolean read FPIO;  
property DMA:Boolean read FDMA;  
property LBA:Boolean read FLBA;  
property Version:LongWord read FVersion;  
 
property MediaType:TMediaType read FMediaType;  
property FloppyType:TFloppyType read FFloppyType;  
property Ready:Boolean read FReady;  
property Locked:Boolean read FLocked;  
property Lockable:Boolean read FLockable;  
property Ejectable:Boolean read FEjectable;  
property Readable:Boolean read FReadable;  
property Writeable:Boolean read FWriteable;  
property Eraseable:Boolean read FEraseable;  
property Removable:Boolean read FRemovable;  
property ChangeLine:Boolean read FChangeLine;  
 
property PhysicalCylinders:LongWord read FPhysicalCylinders;  
property PhysicalHeads:LongWord read FPhysicalHeads;  
property PhysicalSectors:LongWord read FPhysicalSectors;  
 
property LogicalCylinders:LongWord read FLogicalCylinders;  
property LogicalHeads:LongWord read FLogicalHeads;  
property LogicalSectors:LongWord read FLogicalSectors;  
 
property SectorSize:Word read FSectorSize;  
property SectorCount:Int64 read FSectorCount;  
property SectorShiftCount:Word read FSectorShiftCount;  
 
property PageCount:Word read FPageCount write FPageCount;  
property PageShift:Word read FPageShift write FPageShift;  
property PageMask:LongWord read FPageMask write FPageMask;  
 
property FreeSectors:Int64 read GetFreeSectors;  
property AvailableSectors:Int64 read GetAvailableSectors;  
 
property DiskSignature:LongWord read GetDiskSignature write SetDiskSignature;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function DeviceInit:Boolean; virtual;  
 
function LocatePartitions:Boolean; virtual;  
function LocateVolumes:Boolean; virtual;  
 
function CreateVolume:TDiskVolume; virtual;  
function DeleteVolume(AVolume:TDiskVolume):Boolean; virtual;  
 
function CreatePartition(AParent:TDiskPartition; APartitionId:Byte; ACount:LongWord; AActive:Boolean):Boolean; virtual;  
function DeletePartition(APartition:TDiskPartition):Boolean; virtual;  
function ModifyPartition(APartition:TDiskPartition; APartitionId:Byte):Boolean; virtual;  
function ActivatePartition(APartition:TDiskPartition; AActive:Boolean):Boolean; virtual;  
function ShrinkPartition(APartition:TDiskPartition; const AStart,ASize:Int64):Boolean; virtual;  
function ExpandPartition(APartition:TDiskPartition; const AStart,ASize:Int64):Boolean; virtual;  
 
function Reset:Boolean;  
 
function LockMedia:Boolean;  
function UnlockMedia:Boolean;  
function EjectMedia:Boolean;  
 
function MediaReady:Boolean;  
function MediaChanged:Boolean;  
function MediaLocked:Boolean;  
 
function InsertDevice:Boolean; virtual;  
function EjectDevice:Boolean; virtual;  
 
function OpenDevice(AMode:Integer):Integer; virtual;  
procedure CloseDevice(AHandle:Integer); virtual;  
function ReadDevice(AHandle:Integer; var ABuffer; ACount:Integer):Integer; virtual;  
function WriteDevice(AHandle:Integer; const ABuffer; ACount:Integer):Integer; virtual;  
function EraseDevice(AHandle:Integer; ACount:Integer):Integer; virtual;  
function SeekDevice(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64; virtual;  

Disk partition

TDiskPartition = class(TListObject)

constructor Create(ADriver:TFileSysDriver; ADevice:TDiskDevice; APartition:TDiskPartition; APartitionNo:Integer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FDevice:TDiskDevice;  
FPartition:TDiskPartition;  
 
FPartitionNo:Integer; \Partition1, \Partition2 etc - See Notes
 
FEntryNo:Integer; 0,1,2,3
FPartitionId:Byte; Partition Type from Table
 
FBeginHead:Word; Logical Starting Head (not Physical)
FBeginSector:Word; Logical Starting Sector (not Physical)
FBeginCylinder:Word; Logical Starting Cylinder (not Physical)
FEndHead:Word; Logical Ending Head (not Physical)
FEndSector:Word; Logical Ending Sector (not Physical)
FEndCylinder:Word; Logical Ending Cylinder (not Physical)
FSectorOffset:LongWord; Offset in Sectors from Location of Table to StartSector
 
FActive:Boolean; Active Partition Indicator ($80)
FExtended:Boolean; Extended Partition Type (no Volume) - Set by Recognizer
FRecognizable:Boolean; Partition allows Recognize Partition
FRecognized:Boolean; Recognized Partition Id - Set by Recognizer
 
FNonVolume:Boolean; Non Volume Partition (eg Linux Swap) - Set by Recognizer
FMultiVolume:Boolean; Multiple Volume Partition (eg Netware) - Set by Recognizer
 
FStartSector:Int64; Absolute Start Sector on Device
FSectorCount:LongWord; Total Sectors in Partition
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetName:String;  
function GetPath:String;  
function GetParent:String;  
function GetLogical:Boolean;  
function GetPrimary:Boolean;  
procedure SetExtended(AExtended:Boolean);  
 
function GetFreeSectors:LongWord; Unused Sectors in Partition
function GetAvailableSectors:LongWord; Largest block of Unused Sectors
 
function GetAvailableBlock(var AStart,ACount:LongWord):Boolean;  
 
function GetRoot:TDiskPartition;  
function GetParentStart:LongWord;  
 
function GetPartitionRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
function SetPartitionRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
public
property Name:String read GetName;  
property Path:String read GetPath;  
property Parent:String read GetParent;  
property Device:TDiskDevice read FDevice;  
property Partition:TDiskPartition read FPartition;  
property PartitionNo:Integer read FPartitionNo;  
 
property EntryNo:Integer read FEntryNo write FEntryNo;  
property PartitionId:Byte read FPartitionId;  
 
property BeginHead:Word read FBeginHead;  
property BeginSector:Word read FBeginSector;  
property BeginCylinder:Word read FBeginCylinder;  
property EndHead:Word read FEndHead;  
property EndSector:Word read FEndSector;  
property EndCylinder:Word read FEndCylinder;  
property SectorOffset:LongWord read FSectorOffset;  
 
property Active:Boolean read FActive;  
property Logical:Boolean read GetLogical;  
property Primary:Boolean read GetPrimary;  
property Extended:Boolean read FExtended write SetExtended;  
property Recognizable:Boolean read FRecognizable;  
property Recognized:Boolean read FRecognized write FRecognized;  
 
property NonVolume:Boolean read FNonVolume write FNonVolume;  
property MultiVolume:Boolean read FMultiVolume write FMultiVolume;  
 
property StartSector:Int64 read FStartSector;  
property SectorCount:LongWord read FSectorCount;  
 
property FreeSectors:LongWord read GetFreeSectors;  
property AvailableSectors:LongWord read GetAvailableSectors;  
 
property Root:TDiskPartition read GetRoot;  
property ParentStart:LongWord read GetParentStart;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  
 
function PartitionInit:Boolean; virtual;  
 
function LocatePartitions:Boolean; virtual;  
function LocateVolumes:Boolean; virtual;  
 
function CreateVolume:TDiskVolume; virtual;  
function DeleteVolume(AVolume:TDiskVolume):Boolean; virtual;  
 
function OpenPartition(AMode:Integer):Integer; virtual;  
procedure ClosePartition(AHandle:Integer); virtual;  
function ReadPartition(AHandle:Integer; var ABuffer; ACount:Integer):Integer; virtual;  
function WritePartition(AHandle:Integer; const ABuffer; ACount:Integer):Integer; virtual;  
function SeekPartition(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64; virtual;  

Disk volume

TDiskVolume = class(TListObject)

constructor Create(ADriver:TFileSysDriver; ADevice:TDiskDevice; APartition:TDiskPartition; AVolumeNo:Integer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FDevice:TDiskDevice;  
FPartition:TDiskPartition;  
 
FVolumeNo:Integer; \Volume1 , \Volume2, etc - See Notes
FSegmentNo:Integer; Segment0, Segment1 etc - for Multiple Segment volumes (eg Netware)
 
FDriveType:TDriveType;  
 
FFileSystem:TFileSystem;  
 
FRemovable:Boolean; Volume is Removable - Set by VolumeInit
FRecognizable:Boolean; Volume allows Recognize Volume
FRecognized:Boolean; Recognized Volume - Set by Recognizer
 
FSectorSize:Word; Sector Size of Device
FStartSector:Int64; Absolute Start Sector on Device
FSectorCount:LongWord; Total Sectors in Volume
FSectorShiftCount:Word; Sectors to Bytes Shift Count
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetName:String;  
function GetParent:String;  
 
function GetMaxFile:Integer;  
function GetMaxPath:Integer;  
function GetAttributes:LongWord;  
function GetSystemName:String;  
function GetVolumeName:String;  
function GetVolumeGUID:String;  
function GetVolumeSerial:LongWord;  
function GetFileSysType:TFileSysType;  
 
procedure SetFileSystem(AFileSystem:TFileSystem);  
 
function GetSectorSize:Word;  
function GetStartSector:Int64;  
function GetSectorCount:LongWord;  
function GetSectorShiftCount:Word;  
 
function MediaTypeToDriveType(AMediaType:TMediaType):TDriveType;  
 
function GetBootRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
function SetBootRecord(ARecord:Pointer,ASector:LongWord):Boolean; virtual;  
public
property Name:String read GetName;  
property Parent:String read GetParent;  
property Device:TDiskDevice read FDevice;  
property Partition:TDiskPartition read FPartition;  
property VolumeNo:Integer read FVolumeNo;  
property SegmentNo:Integer read FSegmentNo;  
 
property MaxFile:Integer read GetMaxFile;  
property MaxPath:Integer read GetMaxPath;  
property Attributes:LongWord read GetAttributes;  
property SystemName:String read GetSystemName;  
property VolumeName:String read GetVolumeName;  
property VolumeGUID:String read GetVolumeGUID;  
property VolumeSerial:LongWord read GetVolumeSerial;  
 
property DriveType:TDriveType read FDriveType;  
property FileSysType:TFileSysType read GetFileSysType;  
 
property FileSystem:TFileSystem read FFileSystem write SetFileSystem;  
 
property Removable:Boolean read FRemovable;  
property Recognizable:Boolean read FRecognizable;  
property Recognized:Boolean read FRecognized write FRecognized;  
 
property SectorSize:Word read GetSectorSize;  
property StartSector:Int64 read GetStartSector;  
property SectorCount:LongWord read GetSectorCount;  
property SectorShiftCount:Word read GetSectorShiftCount;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function VolumeInit:Boolean; virtual;  
 
function CreateDrive(ADriveNo:Integer):TDiskDrive; virtual;  
function DeleteDrive(ADrive:TDiskDrive):Boolean; virtual;  
 
function MountVolume(ADriveNo:Integer):Boolean; virtual;  
function DismountVolume:Boolean; virtual;  
function FormatVolume(AFloppyType:TFloppyType; AFileSysType:TFileSysType):Boolean; virtual;  
function DefragmentVolume:Boolean; virtual;  
function ConvertVolume(AFileSysType:TFileSysType):Boolean; virtual;  
function RepairVolume:Boolean; virtual;  
function CopyVolume(ADest:TDiskVolume):Boolean; virtual;  
function ShrinkVolume(const AStart,ASize:Int64):Boolean; virtual;  
function ExpandVolume(const AStart,ASize:Int64):Boolean; virtual;  
 
function OpenVolume(AMode:Integer):Integer; virtual;  
procedure CloseVolume(AHandle:Integer); virtual;  
function ReadVolume(AHandle:Integer; var ABuffer; ACount:Integer):Integer; virtual;  
function WriteVolume(AHandle:Integer; const ABuffer; ACount:Integer):Integer; virtual;  
function SeekVolume(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64; virtual;  

Disk image

TDiskImage = class(TListObject)

constructor Create(ADriver:TFileSysDriver; AController:TDiskController; const AName:String; AImageNo:Integer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FController:TDiskController;  
 
FName:String;  
FImageNo:Integer;  
 
FLocked:Boolean;  
FChanged:Boolean;  
FAttributes:LongWord;  
 
FImageType:TImageType;  
FMediaType:TMediaType;  
FFloppyType:TFloppyType;  
 
FCylinders:LongWord; Physical Cylinders on Drive
FHeads:LongWord; Physical Heads on Drive
FSectors:LongWord; Physical Sectors per Track
FLogicalShiftCount:Word; Physical to Logical Shift Count
 
FSectorSize:Word; Bytes Per Sector
FSectorCount:Int64; Total Sectors
FSectorShiftCount:Word; Sectors to Bytes Shift Count
 
FPartitionId:Byte; Partition Type for Table
FFileSysType:TFileSysType;  
 
FDevice:TDiskDevice;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetReady:Boolean; virtual;  
function GetReadable:Boolean; virtual;  
function GetWriteable:Boolean; virtual;  
function GetEraseable:Boolean; virtual;  
 
function GetCylinders:LongWord; virtual;  
function GetHeads:LongWord; virtual;  
function GetSectors:LongWord; virtual;  
function GetLogicalShiftCount:Word; virtual;  
 
function GetSectorSize:Word; virtual;  
function GetSectorCount:Int64; virtual;  
function GetSectorShiftCount:Word; virtual;  
 
function GetPartitionId:Byte; virtual;  
 
function GetName:String; virtual;  
procedure SetName(const AName:String); virtual;  
procedure SetDevice(ADevice:TDiskDevice);  
public
property Controller:TDiskController read FController;  
 
property Name:String read GetName write SetName;  
property ImageNo:Integer read FImageNo;  
 
property Ready:Boolean read GetReady;  
property Locked:Boolean read FLocked;  
property Changed:Boolean read FChanged;  
property Readable:Boolean read GetReadable;  
property Writeable:Boolean read GetWriteable;  
property Eraseable:Boolean read GetEraseable;  
property Attributes:LongWord read FAttributes;  
 
property ImageType:TImageType read FImageType;  
property MediaType:TMediaType read FMediaType;  
property FloppyType:TFloppyType read FFloppyType;  
 
property Cylinders:LongWord read FCylinders;  
property Heads:LongWord read FHeads;  
property Sectors:LongWord read FSectors;  
property LogicalShiftCount:Word read FLogicalShiftCount;  
 
property SectorSize:Word read FSectorSize;  
property SectorCount:Int64 read FSectorCount;  
property SectorShiftCount:Word read FSectorShiftCount;  
 
property PartitionId:Byte read FPartitionId;  
property FileSysType:TFileSysType read FFileSysType;  
 
property Device:TDiskDevice read FDevice write SetDevice;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  
function WriterOwner:Boolean;  
 
function ImageInit:Boolean; virtual;  
 
function LockMedia:Boolean; virtual;  
function UnlockMedia:Boolean; virtual;  
function EjectMedia:Boolean; virtual;  
 
function MediaReady:Boolean; virtual;  
function MediaChanged:Boolean; virtual;  
function MediaLocked:Boolean; virtual;  
 
function Read(ASector:LongWord; ACount:Word; var ABuffer):Boolean; virtual;  
function Write(ASector:LongWord; ACount:Word; const ABuffer):Boolean; virtual;  
function Allocated(ASector:LongWord; ACount:Word):Word; virtual;  
 
function MountImage:Boolean; virtual;  
function DismountImage:Boolean; virtual;  
function InsertImage:Boolean; virtual;  
function EjectImage:Boolean; virtual;  
function ConvertImage(AImageType:TImageType):Boolean; virtual;  
function CopyImage(ADest:TDiskImage):Boolean; virtual;  
function ShrinkImage(const ASize:Int64):Boolean; virtual;  
function ExpandImage(const ASize:Int64):Boolean; virtual;  
 
function CreateImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; virtual;  
function OpenImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; virtual;  
function CloseImage:Boolean; virtual;  
function ResizeImage(const ASectorCount:Int64):Boolean; virtual;  
 
function CreateSnapshot:Boolean; virtual;  
function DeleteSnapshot:Boolean; virtual;  
function MergeSnapshot:Boolean; virtual;  

Recognizer

TRecognizer = class(TListObject)

constructor Create(ADriver:TFileSysDriver);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
 
FAllowDrive:Boolean; Enable mounting with an attached Drive
FAllowDefault:Boolean; Enable mounting of unrecognized media (Unpartitioned Media Only)
 
FDirtyCheck:Boolean; Enable checking Volume when dirty flag set on mount
FQuickCheck:Boolean; Enable quick check only when checking dirty Volume
 
FPartitioner:TDiskPartitioner;  
FFormatter:TDiskFormatter;  
FDefragger:TDiskDefragger;  
FConverter:TDiskConverter;  
FRepairer:TDiskRepairer;  
FResizer:TDiskResizer;  
FCopier:TDiskCopier;  
FImager:TDiskImager;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetName:String; virtual;  
public
property Name:String read GetName;  
 
property AllowDrive:Boolean read FAllowDrive write FAllowDrive;  
property AllowDefault:Boolean read FAllowDefault write FAllowDefault;  
 
property DirtyCheck:Boolean read FDirtyCheck write FDirtyCheck;  
property QuickCheck:Boolean read FQuickCheck write FQuickCheck;  
 
property Partitioner:TDiskPartitioner read FPartitioner write FPartitioner;  
property Formatter:TDiskFormatter read FFormatter write FFormatter;  
property Defragger:TDiskDefragger read FDefragger write FDefragger;  
property Converter:TDiskConverter read FConverter write FConverter;  
property Repairer:TDiskRepairer read FRepairer write FRepairer;  
property Resizer:TDiskResizer read FResizer write FResizer;  
property Copier:TDiskCopier read FCopier write FCopier;  
property Imager:TDiskImager read FImager write FImager;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  
 
function RecognizePartitionId(APartitionId:Byte):Boolean; virtual;  
function RecognizeBootSector(ABootSector:PBootSector; const AStartSector,ASectorCount:Int64):Boolean; virtual;  
 
function RecognizePartition(APartition:TDiskPartition):Boolean; virtual;  
function RecognizeVolume(AVolume:TDiskVolume):Boolean; virtual;  
function MountVolume(AVolume:TDiskVolume; ADrive:TDiskDrive):Boolean; virtual;  
function DismountVolume(AVolume:TDiskVolume):Boolean; virtual;  
 
function RecognizeImage(AImage:TDiskImage):Boolean; virtual;  
function MountImage(AImage:TDiskImage):Boolean; virtual;  
function DismountImage(AImage:TDiskImage):Boolean; virtual;  
function InsertImage(AImage:TDiskImage):Boolean; virtual;  
function EjectImage(AImage:TDiskImage):Boolean; virtual;  

Redirector

TRedirector = class(TListObject)

constructor Create(ADriver:TFileSysDriver);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function LocateDrives:Boolean; virtual;  
 
function RedirectPath(const APath:String):Boolean; virtual;  
function RedirectDrive(ADrive:TDiskDrive):Boolean; virtual;  
function AttachPath(const APath:String; ADrive:TDiskDrive):Boolean; virtual;  
function DetachDrive(ADrive:TDiskDrive):Boolean; virtual;  

Disk partitioner

TDiskPartitioner = class(TObject)

constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FRecognizer:TRecognizer;  
 
FInitChar:Byte; Character to initialize sectors when adding partitions
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function CheckLogical(ADevice:TDiskDevice; AParent:TDiskPartition; APartitionId:Byte):Boolean; virtual;  
function CheckExtended(ADevice:TDiskDevice; AParent:TDiskPartition; APartitionId:Byte):Boolean; virtual;  
 
function GetLogicalChild(ADevice:TDiskDevice; APartition:TDiskPartition; ALock:Boolean; AState:LongWord):TDiskPartition;  
function GetExtendedSibling(ADevice:TDiskDevice; AParent:TDiskPartition; ALock:Boolean; AState:LongWord):TDiskPartition;  
function GetExtendedParent(ADevice:TDiskDevice; AParent:TDiskPartition; AStart:LongWord; ALock:Boolean; AState:LongWord):TDiskPartition;  
 
function GetEndCHS(ADevice:TDiskDevice; AStart,ACount:LongWord; var ACylinder,AHead,ASector:Word):Boolean; virtual;  
function GetStartCHS(ADevice:TDiskDevice; AStart,ACount:LongWord; var ACylinder,AHead,ASector:Word):Boolean; virtual;  
 
function GetSectorCount(ADevice:TDiskDevice; AStart,ACount:LongWord):LongWord; virtual;  
function GetStartSector(ADevice:TDiskDevice; AExtended,ALogical:Boolean; AStart:LongWord; var ACount:LongWord):LongWord; virtual;  
function GetSectorOffset(ADevice:TDiskDevice; AParent:TDiskPartition; AExtended:Boolean; AStart:LongWord):LongWord; virtual;  
function GetPartitionId(ADevice:TDiskDevice; AParent:TDiskPartition; AStart,ACount:LongWord; APartitionId:Byte):Byte; virtual;  
 
function InitPartition(ADevice:TDiskDevice; AParent:TDiskPartition; AStart,ACount:LongWord; APartitionId:Byte):Boolean; virtual;  
 
function CreatePartitionRecord(ADevice:TDiskDevice; ARecord:PPartitionRecord):Boolean;  
function CreatePartitionEntry(ADevice:TDiskDevice; AStart,ACount,AOffset:LongWord; APartitionId:Byte; AActive:Boolean; var AEntry:TPartitionEntry):Boolean;  
 
function FillSectors(ADevice:TDiskDevice; APartition:TDiskPartition; ASector,ACount:LongWord; AValue:Byte):Boolean;  
function ReadSectors(ADevice:TDiskDevice; APartition:TDiskPartition; ASector,ACount:LongWord; var ABuffer):Boolean;  
function WriteSectors(ADevice:TDiskDevice; APartition:TDiskPartition; ASector,ACount:LongWord; const ABuffer):Boolean;  
public
property InitChar:Byte read FInitChar write FInitChar;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function AcceptPartition(ADevice:TDiskDevice; APartition,AParent:TDiskPartition; APartitionId:Byte):Boolean; virtual;  
 
function CreatePartition(ADevice:TDiskDevice; AParent:TDiskPartition; APartitionId:Byte; ACount:LongWord; AActive:Boolean):Boolean; virtual;  
function DeletePartition(APartition:TDiskPartition):Boolean; virtual;  
function ModifyPartition(APartition:TDiskPartition; APartitionId:Byte; AOverride:Boolean):Boolean; virtual;  
function ActivatePartition(APartition:TDiskPartition; AActive:Boolean):Boolean; virtual;  

Disk formatter

TDiskFormatter = class(TObject)

constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FRecognizer:TRecognizer;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function FillSectors(AVolume:TDiskVolume; ADrive:TDiskDrive; ASector,ACount:LongWord; AValue:Byte):Boolean;  
function ReadSectors(AVolume:TDiskVolume; ADrive:TDiskDrive; ASector,ACount:LongWord; var ABuffer):Boolean;  
function WriteSectors(AVolume:TDiskVolume; ADrive:TDiskDrive; ASector,ACount:LongWord; const ABuffer):Boolean;  
public
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function AcceptVolume(AVolume:TDiskVolume; AFloppyType:TFloppyType; AFileSysType:TFileSysType):Boolean; virtual;  
 
function FormatVolume(AVolume:TDiskVolume; AFloppyType:TFloppyType; AFileSysType:TFileSysType):Boolean; virtual;  

Disk defragger

TDiskDefragger = class(TObject)

constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FRecognizer:TRecognizer;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function AcceptVolume(AVolume:TDiskVolume):Boolean; virtual;  
 
function DefragmentVolume(AVolume:TDiskVolume):Boolean; virtual;  

Disk converter

TDiskConverter = class(TObject)

constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FRecognizer:TRecognizer;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function AcceptVolume(AVolume:TDiskVolume; AFileSysType:TFileSysType):Boolean; virtual;  
 
function ConvertVolume(AVolume:TDiskVolume; AFileSysType:TFileSysType):Boolean; virtual;  
 
function AcceptImage(AImage:TDiskImage; AImageType:TImageType):Boolean; virtual;  
 
function ConvertImage(AImage:TDiskImage; AImageType:TImageType):Boolean; virtual;  

Disk repairer

TDiskRepairer = class(TObject)

constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FRecognizer:TRecognizer;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function AcceptVolume(AVolume:TDiskVolume):Boolean; virtual;  
 
function RepairVolume(AVolume:TDiskVolume):Boolean; virtual;  

Disk resizer

TDiskResizer = class(TObject)

constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FRecognizer:TRecognizer;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function AcceptVolume(AVolume:TDiskVolume; const AStart,ASize:Int64):Boolean; virtual;  
 
function ShrinkVolume(AVolume:TDiskVolume; const AStart,ASize:Int64):Boolean; virtual;  
function ExpandVolume(AVolume:TDiskVolume; const AStart,ASize:Int64):Boolean; virtual;  
 
function AcceptPartition(APartition:TDiskPartition; const AStart,ASize:Int64):Boolean; virtual;  
 
function ShrinkPartition(APartition:TDiskPartition; const AStart,ASize:Int64):Boolean; virtual;  
function ExpandPartition(APartition:TDiskPartition; const AStart,ASize:Int64):Boolean; virtual;  
 
function AcceptImage(AImage:TDiskImage; const ASize:Int64):Boolean; virtual;  
 
function ShrinkImage(AImage:TDiskImage; const ASize:Int64):Boolean; virtual;  
function ExpandImage(AImage:TDiskImage; const ASize:Int64):Boolean; virtual;  

Disk copier

TDiskCopier = class(TObject)

constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FRecognizer:TRecognizer;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function AcceptVolume(AVolume,ADest:TDiskVolume):Boolean; virtual;  
 
function CopyVolume(AVolume,ADest:TDiskVolume):Boolean; virtual;  
 
function AcceptImage(AImage,ADest:TDiskImage):Boolean; virtual;  
 
function CopyImage(AImage,ADest:TDiskImage):Boolean; virtual;  

Disk imager

TDiskImager = class(TObject)

constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FRecognizer:TRecognizer;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
 
function AcceptImage(AImage:TDiskImage; const AName:String; AImageType:TImageType; AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64):Boolean; virtual;  
 
function CreateImage(AImage:TDiskImage; const AName:String; AImageType:TImageType; AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; virtual;  
function OpenImage(AImage:TDiskImage; const AName:String; AImageType:TImageType; AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; virtual;  
function CloseImage(AImage:TDiskImage):Boolean; virtual;  
 
function AcceptSnapshot(AImage:TDiskImage):Boolean; virtual;  
 
function CreateSnapshot(AImage:TDiskImage):Boolean; virtual;  
function DeleteSnapshot(AImage:TDiskImage):Boolean; virtual;  
function MergeSnapshot(AImage:TDiskImage):Boolean; virtual;  

File system

TFileSystem = class(TListObject)

constructor Create(ADriver:TFileSysDriver; AVolume:TDiskVolume; ADrive:TDiskDrive);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
protected
FDriver:TFileSysDriver;  
FVolume:TDiskVolume;  
FDrive:TDiskDrive;  
 
FPathChar:String; Path separator character
FNameChar:String; Name separator character
FFileChar:String; File separator character
FRootChar:String; Root specifier character (eg C:)
FRootName:String;  
FRootPath:String; Root Path must be prefixed with \\.
FMaxFile:Integer;  
FMaxPath:Integer;  
FMaxAltFile:Integer;  
FMaxAltPath:Integer;  
FAttributes:LongWord;  
FMaxAttributes:LongWord;  
FMaskAttributes:LongWord;  
FMountPointTag:LongWord;  
FSymbolicLinkTag:LongWord;  
FSystemName:String;  
FVolumeName:String;  
FVolumeGUID:String;  
FVolumeSerial:LongWord;  
FFileSysType:TFileSysType;  
 
FSectorSize:Word;  
FStartSector:Int64;  
FSectorCount:LongWord;  
 
FRoot:TDiskEntry;  
 
FCurrentIndex:LongWord; TLS Index for storing current directory
 
FChunks:TFileSysList;  
FTables:TFileSysList;  
FBlocks:TFileSysList;  
FEntries:TFileSysTree;  
FCatalogs:TFileSysList;  
FAcls:TFileSysList;  
 
FChunkLocal:TMutexHandle; Local Lock shared by all DiskChunk objects
FTableLocal:TMutexHandle; Local Lock shared by all DiskTable objects
FBlockLocal:TMutexHandle; Local Lock shared by all DiskBlock objects
FEntryLocal:TMutexHandle; Local Lock shared by all DiskEntry objects
FCatalogLocal:TMutexHandle; Local Lock shared by all DiskCatalog objects
FSecurityLocal:TMutexHandle; Local Lock shared by all DiskSecurity objects
FAclLocal:TMutexHandle; Local Lock shared by all DiskAcl objects
FAceLocal:TMutexHandle; Local Lock shared by all DiskAce objects
 
FMarkDirty:Boolean; Mark the volume as dirty when dismounting (Either by request or due to error)
FMarkClean:Boolean; Mark the volume as clean when dismounting (Only by request)
FMarkError:Boolean; Error was encounted on volume, mark as dirty when dismounting
FLogDirty:Boolean; LogFile was dirty when mounted (if supported by filesystem)
FMountDirty:Boolean; Volume was dirty when mounted, leave marked as dirty when dismounting
 
FOemConvert:Boolean; Default to True overidden by descendants if not supported
FNumericTail:Boolean; Default to True overidden by descendants if not supported
 
FReadOnly:Boolean; Default to False overidden by descendants if True
FLongNames:Boolean; Default to True overidden by descendants if not supported
FDataStreams:Boolean; Default to False overidden by descendants if supported
FReparsePoints:Boolean; Default to False overidden by descendants if supported
FCaseSensitive:Boolean; Default to False overidden by descendants if supported
FCasePreserved:Boolean; Default to False overidden by descendants if supported
FUnicodeNames:Boolean; Default to False overidden by descendants if supported
FPersistentAcls:Boolean; Default to False overidden by descendants if supported
FFileCompression:Boolean; Default to False overidden by descendants if supported
FVolumeQuotas:Boolean; Default to False overidden by descendants if supported
FSparseFiles:Boolean; Default to False overidden by descendants if supported
FRemoteStorage:Boolean; Default to False overidden by descendants if supported
FVolumeCompressed:Boolean; Default to False overidden by descendants if supported
FObjectIds:Boolean; Default to False overidden by descendants if supported
FEncryption:Boolean; Default to False overidden by descendants if supported
 
FBootCatalog:Boolean; Default to False overidden by descendants if supported
FVirtualVolume:Boolean; Default to False overidden by descendants if supported
FFolderEncryption:Boolean; Default to False overidden by descendants if supported
FFolderCompression:Boolean; Default to False overidden by descendants if supported
 
FBootSector:LongWord; Relative to StartSector
FBootBackup:LongWord; Relative to StartSector
 
FSectorBuffer:Pointer; Buffer of exactly sector size
FSectorLock:TMutexHandle; Lock for sector buffer
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function SectorLock:Boolean;  
function SectorUnlock:Boolean;  
 
procedure SetDrive(ADrive:TDiskDrive); virtual;  
procedure SetVolume(AVolume:TDiskVolume); virtual;  
 
function GetPathChar:String; virtual;  
function GetNameChar:String; virtual;  
function GetFileChar:String; virtual;  
function GetRootChar:String; virtual;  
function GetRootName:String; virtual;  
function GetRootPath:String; virtual;  
function GetSystemName:String; virtual;  
function GetVolumeName:String; virtual;  
function GetVolumeGUID:String; virtual;  
 
function LoadPathChar:String; virtual;  
function LoadNameChar:String; virtual;  
function LoadFileChar:String; virtual;  
function LoadRootChar:String; virtual;  
function LoadRootName:String; virtual;  
function LoadRootPath:String; virtual;  
function LoadMaxFile:Integer; virtual;  
function LoadMaxPath:Integer; virtual;  
function LoadMaxAltFile:Integer; virtual;  
function LoadMaxAltPath:Integer; virtual;  
function LoadAttributes:LongWord; virtual; Get the Volume Attributes
function LoadMaxAttributes:LongWord; virtual; Get the Maximum File Attributes (used when setting file attributes)
function LoadMaskAttributes:LongWord; virtual; Get the File Attributes Mask (used when getting file attributes)
function LoadMountPointTag:LongWord; virtual;  
function LoadSymbolicLinkTag:LongWord; virtual;  
function LoadSystemName:String; virtual;  
function LoadVolumeName:String; virtual;  
function LoadVolumeGUID:String; virtual;  
function LoadVolumeSerial:LongWord; virtual;  
function LoadFileSysType:TFileSysType; virtual;  
 
function LoadSectorSize:Word; virtual;  
function LoadStartSector:Int64; virtual;  
function LoadSectorCount:LongWord; virtual;  
 
function GetCurrent:TDiskEntry; virtual;  
function SetCurrent(ACurrent:TDiskEntry):Boolean; virtual;  
 
function FillSectors(ASector,ACount:LongWord; AValue:Byte):Boolean;  
 
function ReadSectors(ASector,ACount:LongWord; var ABuffer):Boolean;  
function WriteSectors(ASector,ACount:LongWord; const ABuffer):Boolean;  
 
function ReadEntry(AParent,AEntry:TDiskEntry; var ABuffer; const AStart:Int64; ACount:LongWord; var AOffset,AValue:LongWord):Integer; virtual;  
function WriteEntry(AParent,AEntry:TDiskEntry; const ABuffer; const AStart:Int64; ACount:LongWord; var AOffset,AValue:LongWord):Integer; virtual;  
 
function LoadTables:Boolean; virtual;  
function LoadBlocks:Boolean; virtual;  
function LoadEntries(AParent:TDiskEntry):Boolean; virtual;  
function LoadCatalogs:Boolean; virtual;  
 
function LoadTable(ATableNo:LongWord):Boolean; virtual;  
function LoadBlock(ABlockNo:LongWord):Boolean; virtual;  
Note: LoadEntry can be implemented if needed but is not defined here.
Note: LoadCatalog can be implemented if needed but is not defined here.
 
function UnloadEntries(AParent:TDiskEntry):Boolean; virtual;  
 
function AddEntry(AParent:TDiskEntry; const AName:String; AAttributes:LongWord; AReference:Boolean):TDiskEntry; virtual;  
function AddEntryEx(AParent:TDiskEntry; const AName,AAltName:String; AAttributes:LongWord; AReference:Boolean):TDiskEntry; virtual;  
function RemoveEntry(AParent,AEntry:TDiskEntry):Boolean; virtual;  
function RenameEntry(AParent,AEntry:TDiskEntry; const AName:String):Boolean; virtual;  
function RenameEntryEx(AParent,AEntry:TDiskEntry; const AAltName:String):Boolean; virtual;  
function MoveEntry(ASource,ADest,AEntry:TDiskEntry):Boolean; virtual;  
 
function AddCatalog(AEntry:TDiskEntry; AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64):TDiskCatalog; virtual;  
function RemoveCatalog(ACatalog:TDiskCatalog):Boolean; virtual;  
function CheckCatalog(ACatalog:TDiskCatalog; ALock:Boolean; AState:LongWord):Boolean; virtual;  
 
function GetCatalogByNo(ACatalogNo:LongWord; ALock:Boolean; AState:LongWord):TDiskCatalog; virtual;  
function GetCatalogByName(const AName:String; ALock:Boolean; AState:LongWord):TDiskCatalog; virtual;  
function GetCatalogByNext(APrevious:TDiskCatalog; ALock,AUnlock:Boolean; AState:LongWord):TDiskCatalog; virtual;  
 
function GetNextCatalogNo:LongWord; virtual;  
function GetMaxCatalogNo:LongWord; virtual;  
 
function AddHardlink(AEntry,AParent:TDiskEntry; const AName:String; AReference:Boolean):TDiskEntry; virtual;  
function RemoveHardlink(AParent,AEntry:TDiskEntry):Boolean; virtual;  
 
function AddMountPoint(AEntry:TDiskEntry; const ATarget:String):Boolean; virtual;  
function RemoveMountPoint(AEntry:TDiskEntry):Boolean; virtual;  
 
function AddJunctionPoint(AEntry:TDiskEntry; const ATarget:String):Boolean; virtual;  
function RemoveJunctionPoint(AEntry:TDiskEntry):Boolean; virtual;  
 
function AddSymbolicLink(AParent:TDiskEntry; const AName,ATarget:String; AFolder,AReference:Boolean):TDiskEntry; virtual;  
function AddSymbolicLinkEx(AParent:TDiskEntry; const AName,AAltName,ATarget:String; AFolder,AReference:Boolean):TDiskEntry; virtual;  
function RemoveSymbolicLink(AParent,AEntry:TDiskEntry):Boolean; virtual;  
 
function SetTable(ATable:TDiskTable):Boolean; virtual;  
function SetBlock(ABlock:TDiskBlock):Boolean; virtual;  
function SetEntry(AParent,AEntry:TDiskEntry):Boolean; virtual;  
function SetCatalog(ACatalog:TDiskCatalog):Boolean; virtual;  
function SetReparse(AParent,AEntry:TDiskEntry; AReparse:TDiskReparse):Boolean; virtual;  
function SetSecurity(AParent,AEntry:TDiskEntry; ASecurity:TDiskSecurity):Boolean; virtual;  
 
function SizeEntry(AParent,AEntry:TDiskEntry; const ASize:Int64):Boolean; virtual;  
 
function GetTable(ATableNo:LongWord):TDiskTable; virtual;  
function GetTableEx(ATableNo:LongWord; AWrite:Boolean):TDiskTable; virtual;  
function GetBlock(ABlockNo:LongWord):TDiskBlock; virtual;  
function GetBlockEx(ABlockNo:LongWord; AWrite:Boolean):TDiskBlock; virtual;  
function GetEntry(AParent:TDiskEntry; const AName:String; AAttributes:LongWord):TDiskEntry; virtual;  
function GetEntryEx(AParent:TDiskEntry; const AName:String; AAttributes:LongWord; AAdd,ARemove,AWrite:Boolean):TDiskEntry; virtual;  
function GetCatalog(ACatalogNo:LongWord):TDiskCatalog; virtual;  
function GetCatalogEx(ACatalogNo:LongWord; AWrite:Boolean):TDiskCatalog; virtual;  
function GetReparse(AEntry:TDiskEntry):TDiskReparse; virtual;  
function GetSecurity(AEntry:TDiskEntry):TDiskSecurity; virtual;  
 
function MatchEntry(AParent,APrevious:TDiskEntry; const AName:String; AAttributes:LongWord; AAny:Boolean):TDiskEntry; virtual;  
function MatchEntryEx(AParent,APrevious:TDiskEntry; const AName:String; AAttributes:LongWord; AAny,AAdd,ARemove,AWrite:Boolean):TDiskEntry; virtual;  
 
function GetEntryPath(AEntry:TDiskEntry; AAltName:Boolean):String;  
function GetEntryName(AEntry:TDiskEntry; AAltName:Boolean):String;  
 
function SplitPath(const APath:String; var ARelative:Boolean; AFolders:TStrings; var AName:String):Boolean; virtual;  
function SplitName(const AName:String; var AFile,AStream:String):Boolean; virtual;  
function SplitFile(const AFile:String; var AName,AExt:String):Boolean; virtual;  
function SplitStream(const AStream:String; var AName,AType:String):Boolean; virtual;  
 
function BuildPath(ARelative:Boolean; AFolders:TLinkedStringList; const AName:String):String; virtual;  
function BuildName(const AFile,AStream:String):String; virtual;  
function BuildFile(const AName,AExt:String):String; virtual;  
function BuildStream(const AName,AType:String):String; virtual;  
 
function CheckName(const AName:String):Boolean; virtual;  
function CompareName(const AName,AMatch:String; AWildcard:Boolean):Boolean; virtual;  
 
function CheckAltName(const AAltName:String):Boolean; virtual;  
function CompareAltName(const AAltName,AMatch:String; AWildcard:Boolean):Boolean; virtual;  
 
function CheckLinkName(const AName:String):Boolean; virtual;  
 
function GetSecurityFromDescriptor(ADescriptor:Pointer):TDiskSecurity; virtual;  
function GetDescriptorFromSecurity(ASecurity:TDiskSecurity; ADescriptor:Pointer; var ASize:LongWord):Boolean; virtual;  
public
property Volume:TDiskVolume read FVolume write SetVolume;  
property Drive:TDiskDrive read FDrive write SetDrive;  
 
property PathChar:String read GetPathChar;  
property NameChar:String read GetNameChar;  
property FileChar:String read GetFileChar;  
property RootChar:String read GetRootChar;  
property RootName:String read GetRootName;  
property RootPath:String read GetRootPath;  
property MaxFile:Integer read FMaxFile;  
property MaxPath:Integer read FMaxPath;  
property MaxAltFile:Integer read FMaxAltFile;  
property MaxAltPath:Integer read FMaxAltPath;  
property Attributes:LongWord read FAttributes;  
property MaxAttributes:LongWord read FMaxAttributes;  
property MaskAttributes:LongWord read FMaskAttributes;  
property MountPointTag:LongWord read FMountPointTag;  
property SymbolicLinkTag:LongWord read FSymbolicLinkTag;  
property SystemName:String read GetSystemName;  
property VolumeName:String read GetVolumeName;  
property VolumeGUID:String read GetVolumeGUID;  
property VolumeSerial:LongWord read FVolumeSerial;  
property FileSysType:TFileSysType read FFileSysType;  
 
property SectorSize:Word read FSectorSize;  
property StartSector:Int64 read FStartSector;  
property SectorCount:LongWord read FSectorCount;  
 
property MarkDirty:Boolean read FMarkDirty write FMarkDirty;  
property MarkClean:Boolean read FMarkClean write FMarkClean;  
property MarkError:Boolean read FMarkError;  
property LogDirty:Boolean read FLogDirty;  
property MountDirty:Boolean read FMountDirty;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function ReaderConvert:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  
function WriterConvert:Boolean;  
 
function FileSystemInit:Boolean; virtual;  
 
function MountFileSystem:Boolean; virtual;  
function DismountFileSystem:Boolean; virtual;  
function InitializeFileSystem(ASectorsPerCluster:LongWord; AFileSysType:TFileSysType):Boolean; virtual;  
 
function CreateCatalog(const AName:String; AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64):LongWord; virtual;  
function DeleteCatalog(ACatalogNo:LongWord):Boolean; virtual;  
 
function FindFirstCatalog(var ASearchRec:TCatalogSearchRec):Integer; virtual;  
function FindNextCatalog(var ASearchRec:TCatalogSearchRec):Integer; virtual;  
procedure FindCatalogClose(var ASearchRec:TCatalogSearchRec); virtual;  
 
function GetDriveLabel:String; virtual;  
function SetDriveLabel(const ALabel:String):Boolean; virtual;  
function GetDriveSerial:LongWord; virtual;  
function SetDriveSerial(ASerial:LongWord):Boolean; virtual;  
 
function GetDriveFreeSpace:LongWord; virtual;  
function GetDriveFreeSpaceEx:Int64; virtual;  
function GetDriveTotalSpace:LongWord; virtual;  
function GetDriveTotalSpaceEx:Int64; virtual;  
 
function GetDriveInformation(var AClusterSize:LongWord; var ATotalClusterCount,AFreeClusterCount:Int64):Boolean; virtual;  
 
function FileOpen(const FileName:String; Mode:Integer):Integer; virtual;  
function FileCreate(const FileName:String):Integer; virtual;  
function DeleteFile(const FileName:String):Boolean; virtual;  
procedure FileClose(Handle:Integer); virtual;  
function RenameFile(const OldName,NewName:String):Boolean; virtual;  
function FileSeek(Handle,Offset,Origin:Integer):Integer; virtual;  
function FileSeekEx(Handle:Integer; const Offset:Int64; Origin:Integer):Int64; virtual;  
function FileFlush(Handle:Integer):Boolean; virtual;  
function FileTruncate(Handle:Integer):Boolean; virtual;  
 
function FilePos(Handle:Integer):Integer; virtual;  
function FilePosEx(Handle:Integer):Int64; virtual;  
 
function FileGetAttr(const FileName:String):Integer; virtual;  
function FileGetDate(Handle:Integer):Integer; virtual;  
function FileGetSize(Handle:Integer):Integer; virtual;  
function FileGetSizeEx(Handle:Integer):Int64; virtual;  
function FileSetAttr(const FileName:String; Attr:Integer):Integer; virtual;  
function FileSetDate(Handle:Integer; Age:Integer):Integer; virtual;  
function FileSetSize(Handle:Integer; Size:Integer):Integer; virtual;  
function FileSetSizeEx(Handle:Integer; const Size:Int64):Integer; virtual;  
 
function FileRead(Handle:Integer; var Buffer; Count:Integer):Integer; virtual;  
function FileWrite(Handle:Integer; const Buffer; Count:Integer):Integer; virtual;  
 
function CreateDir(const DirName:String):Boolean; virtual;  
function RemoveDir(const DirName:String):Boolean; virtual;  
function GetCurrentDir:String; virtual;  
function SetCurrentDir(const DirName:String):Boolean; virtual;  
 
function FindOne(const Path:String; var SearchRec:TFileSearchRec):Integer; virtual;  
function FindAll(const Path:String; var SearchRec:TFileSearchRec):Integer; virtual;  
 
function FindFirstEx(const Path:String; var SearchRec:TFileSearchRec):Integer; virtual;  
function FindNextEx(var SearchRec:TFileSearchRec):Integer; virtual;  
procedure FindCloseEx(var SearchRec:TFileSearchRec); virtual;  
 
function FindFirstStream(const FileName:String; var SearchRec:TStreamSearchRec):Integer; virtual;  
function FindNextStream(var SearchRec:TStreamSearchRec):Integer; virtual;  
procedure FindStreamClose(var SearchRec:TStreamSearchRec); virtual;  
 
function FindFirstFileName(const FileName:String; var SearchRec:TLinkSearchRec):Integer; virtual;  
function FindNextFileName(var SearchRec:TLinkSearchRec):Integer; virtual;  
procedure FindFileNameClose(var SearchRec:TLinkSearchRec); virtual;  
 
function CreateHardLink(const LinkName,FileName:String):Boolean; virtual;  
function DeleteHardLink(const LinkName:String):Boolean; virtual;  
 
function CreateMountPoint(const PathName,VolumeName:String):Boolean; virtual;  
function DeleteMountPoint(const PathName:String):Boolean; virtual;  
 
function CreateJunctionPoint(const PathName,FolderName:String):Boolean; virtual;  
function DeleteJunctionPoint(const PathName:String):Boolean; virtual;  
 
function CreateSymbolicLink(const LinkName,TargetName:String; Directory:Boolean):Boolean; virtual;  
function CreateSymbolicLinkEx(const LinkName,ShortName,TargetName:String; Directory:Boolean):Boolean; virtual;  
function DeleteSymbolicLink(const LinkName:String):Boolean; virtual;  
 
function GetMountPointTarget(const PathName:String):String; virtual;  
function GetJunctionPointTarget(const PathName:String):String; virtual;  
function GetSymbolicLinkTarget(const LinkName:String):String; virtual;  
 
function SetFileShortName(const FileName,ShortName:String):Boolean; virtual;  
function SetFileShortNameEx(Handle:Integer; const ShortName:String):Boolean; virtual;  
 
function GetFileSecurity(const FileName:String; Descriptor:Pointer; var Size:LongWord):Boolean; virtual;  
function SetFileSecurity(const FileName:String; Descriptor:Pointer):Boolean; virtual;  
 
function GetPathName(const FileName:String):String; virtual;  
 
function GetShortName(const FileName:String):String; virtual;  
function GetLongName(const FileName:String):String; virtual;  
function GetTrueName(const FileName:String):String; virtual;  
 
function FileCreateEx(const FileName,ShortName:String):Integer; virtual;  
function CreateDirEx(const DirName,ShortName:String):Boolean; virtual;  
 
function FileGetAttrEx(Handle:Integer):Integer; virtual;  
 
function FileGetDateEx(Handle:Integer):TFileTime; virtual;  
function FileSetDateEx(Handle:Integer; Age:TFileTime):Integer; virtual;  
function GetFileTime(Handle:Integer; CreateTime,AccessTime,ModifyTime:PFileTime):Boolean; virtual;  
function SetFileTime(Handle:Integer; CreateTime,AccessTime,ModifyTime:PFileTime):Boolean; virtual;  
 
function CloseFile(Handle:THandle):Boolean; virtual; Equivalent to Win32 CloseHandle

Disk chunk

TDiskChunk = class(TListObject)

Note: A disk chunk for multi segment Volumes such as NWFS/NSS.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
protected
FLocalLock:TMutexHandle;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  

Disk table

TDiskTable = class(TListObject)

Note: A disk table such as a FAT or MFT table.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FTableNo:LongWord;  
protected
FLocalLock:TMutexHandle;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
property TableNo:LongWord read FTableNo write FTableNo;  

Disk block

TDiskBlock = class(TListObject)

Note: A disk block such as a FAT entry.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FBlockNo:LongWord;  
protected
FLocalLock:TMutexHandle;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
property BlockNo:LongWord read FBlockNo write FBlockNo;  

Disk entry

TDiskEntry = class(TTreeObject)

Note: A disk entry such as a File, Folder, Stream or Label.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FName:String;  
FHash:LongWord;  
FAltName:String;  
FAltHash:LongWord;  
 
FSize:Int64;  
FAttributes:LongWord;  
FWriteTime:TFileTime;  
FCreateTime:TFileTime;  
FAccessTime:TFileTime;  
 
FReparseTag:LongWord;  
 
FEntriesLoaded:Boolean;  
 
FReferenceCount:LongWord;  
 
FRecent:TDiskEntry;  
 
function GetName:String;  
procedure SetName(const AName:String);  
function GetAltName:String;  
procedure SetAltName(const AAltName:String);  
protected
FLocalLock:TMutexHandle;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
property Name:String read GetName write SetName;  
property Hash:LongWord read FHash;  
property AltName:String read GetAltName write SetAltName;  
property AltHash:LongWord read FAltHash;  
 
property Size:Int64 read FSize write FSize;  
property Attributes:LongWord read FAttributes write FAttributes;  
property WriteTime:TFileTime read FWriteTime write FWriteTime;  
property CreateTime:TFileTime read FCreateTime write FCreateTime;  
property AccessTime:TFileTime read FAccessTime write FAccessTime;  
 
property ReparseTag:LongWord read FReparseTag write FReparseTag;  
 
property EntriesLoaded:Boolean read FEntriesLoaded write FEntriesLoaded;  
 
property ReferenceCount:LongWord read FReferenceCount;  
 
property Recent:TDiskEntry read FRecent write FRecent;  
 
function AddReference:Boolean; virtual;  
function RemoveReference:Boolean; virtual;  
 
function FindFirstName(AHandle:TFindHandle; AReference:Boolean):TDiskEntry; virtual;  
function FindPrevName(AHandle:TFindHandle; AReference:Boolean):TDiskEntry; virtual;  
function FindNextName(AHandle:TFindHandle; AReference:Boolean):TDiskEntry; virtual;  
function FindLastName(AHandle:TFindHandle; AReference:Boolean):TDiskEntry; virtual;  

Disk catalog

TDiskCatalog = class(TListObject)

Note: A disk catalog such as a bootable section.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
protected
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
 
FName:String;  
FHash:LongWord;  
FPath:String;  
FCatalogNo:LongWord;  
 
FMediaType:TMediaType;  
FFloppyType:TFloppyType;  
FAttributes:LongWord; Initial/Default, Bootable, No Emulation, 1.2M, 1.44M, 2.88M, Hard Disk
FSectorSize:Word;  
FSectorCount:Int64;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetName:String; virtual;  
procedure SetName(const AName:String); virtual;  
function GetPath:String; virtual;  
procedure SetPath(const APath:String); virtual;  
function GetMediaType:TMediaType; virtual;  
procedure SetMediaType(AMediaType:TMediaType); virtual;  
function GetFloppyType:TFloppyType; virtual;  
procedure SetFloppyType(AFloppyType:TFloppyType); virtual;  
function GetAttributes:LongWord; virtual;  
procedure SetAttributes(AAttributes:LongWord); virtual;  
function GetSectorSize:Word; virtual;  
procedure SetSectorSize(ASectorSize:Word); virtual;  
function GetSectorCount:Int64; virtual;  
procedure SetSectorCount(const ASectorCount:Int64); virtual;  
public
property Name:String read GetName write SetName;  
property Hash:LongWord read FHash;  
property Path:String read GetPath write SetPath;  
property CatalogNo:LongWord read FCatalogNo write FCatalogNo;  
 
property MediaType:TMediaType read GetMediaType write SetMediaType;  
property FloppyType:TFloppyType read GetFloppyType write SetFloppyType;  
property Attributes:LongWord read GetAttributes write SetAttributes;  
property SectorSize:Word read GetSectorSize write SetSectorSize;  
property SectorCount:Int64 read GetSectorCount write SetSectorCount;  
 
function ReaderLock:Boolean;  
function ReaderUnlock:Boolean;  
function WriterLock:Boolean;  
function WriterUnlock:Boolean;  

Disk reparse

TDiskReparse = class(TObject)

constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
protected
FLocalLock:TMutexHandle;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetTarget:String; virtual;  
procedure SetTarget(const ATarget:String); virtual;  
public
property Target:String read GetTarget write SetTarget;  

Disk security

TDiskSecurity = class(TObject)

Note: A disk security descriptor.
 
constructor Create(ALocalLock:TMutexHandle);  
constructor CreateFromSecurity(ALocalLock:TMutexHandle; ASecurity:TDiskSecurity); virtual;  
constructor CreateFromDescriptor(ALocalLock:TMutexHandle; ADescriptor:Pointer); virtual;  
destructor Destroy; override;  
private
FAcls:TFileSysList;  
FAclLock:TMutexHandle;  
protected
FLocalLock:TMutexHandle;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
function SecuritySize:LongWord; virtual;  
 
function SecurityDescriptor:Pointer; virtual;  
function SecurityDescriptorEx(ALocal:Boolean):Pointer; virtual;  
function InheritedDescriptor:Pointer; virtual;  
function MergedDescriptor(AChild:Pointer):Pointer; virtual;  
function ReleaseDescriptor(ADescriptor:Pointer; AInherited,AMerged:Boolean):Boolean; virtual;  
 
function CopyToSecurity(ASecurity:TDiskSecurity):Boolean; virtual;  
function CopyFromSecurity(ASecurity:TDiskSecurity):Boolean; virtual;  
 
function CopyToDescriptor(ADescriptor:Pointer; ASize:LongWord):Boolean; virtual;  
function CopyToDescriptorEx(ADescriptor:Pointer; ASize:LongWord; ALocal:Boolean):Boolean; virtual;  
function CopyFromDescriptor(ADescriptor:Pointer; ASize:LongWord):Boolean; virtual;  

Disk access control list

TDiskAcl = class(TListObject)

Note: A security descriptor access control list.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FAces:TFileSysList;  
FAceLock:TMutexHandle;  
protected
FLocalLock:TMutexHandle;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  

Disk access control entry

TDiskAce = class(TListObject)

Note: A security descriptor access control entry.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
protected
FLocalLock:TMutexHandle;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  

Cache

TCache = class(TObject)

Note: A simple block cache with Read Only/Read Write modes and Free/Clean/Dirty page tracking. (No longer used)
 
constructor Create(ADriver:TFileSysDriver);  
destructor Destroy; override;  
private
FDriver:TFileSysDriver;  
 
FLock:TCriticalSectionHandle;  
 
FBuffer:Pointer;  
FPageSize:LongWord;  
FPageCount:LongWord;  
FCacheSize:LongWord;  
FCacheMode:TCacheMode;  
FCacheState:TCacheState;  
FCacheTimeout:LongWord;  
 
FReadCached:Int64;  
FReadDirect:Int64;  
 
FWriteBack:Int64;  
FWriteThrough:Int64;  
FWriteDirect:Int64;  
 
FHitCount:Int64;  
FMissCount:Int64;  
 
FFailCount:Int64;  
FSuccessCount:Int64;  
 
FFlushCount:Int64;  
FDiscardCount:Int64;  
FUnknownCount:Int64;  
 
FFirstPage:TCachePage; First Cache Page (Any State)
FLastPage:TCachePage; Last Cache Page (Any State)
FFirstEmpty:TCachePage; First Free Page
FLastEmpty:TCachePage; Last Free Page
FFirstClean:TCachePage; First Clean Page (Used with no Write pending)
FLastClean:TCachePage; Last Clean Page (Used with no Write pending)
FFirstDirty:TCachePage; First Dirty Page (Used with Write pending)
FLastDirty:TCachePage; Last Dirty Page (Used with Write pending)
 
FTimer:TCacheTimer;  
FThread:TCacheThread;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function AddPage(APage:TCachePage):Boolean;  
function RemovePage(APage:TCachePage):Boolean;  
function AddEmpty(APage:TCachePage):Boolean;  
function AddClean(APage:TCachePage):Boolean;  
function AddDirty(APage:TCachePage):Boolean;  
function AddUnknown(APage:TCachePage):Boolean;  
 
function UpdateClean(APage:TCachePage):Boolean;  
function UpdateDirty(APage:TCachePage):Boolean;  
 
function RoundPageSize(APageSize:LongWord):LongWord;  
function RoundCacheSize(ACacheSize,APageSize:LongWord):LongWord;  
 
function LinkPage(APage:TCachePage):Boolean;  
function UnlinkPage(APage:TCachePage):Boolean;  
function LinkEmpty(APage:TCachePage):Boolean;  
function UnlinkEmpty(APage:TCachePage):Boolean;  
function LinkClean(APage:TCachePage):Boolean;  
function UnlinkClean(APage:TCachePage):Boolean;  
function LinkDirty(APage:TCachePage):Boolean;  
function UnlinkDirty(APage:TCachePage):Boolean;  
public
property PageSize:LongWord read FPageSize;  
property PageCount:LongWord read FPageCount;  
property CacheSize:LongWord read FCacheSize;  
property CacheMode:TCacheMode read FCacheMode;  
property CacheState:TCacheState read FCacheState;  
property CacheTimeout:LongWord read FCacheTimeout;  
 
property ReadCached:Int64 read FReadCached;  
property ReadDirect:Int64 read FReadDirect;  
 
property WriteBack:Int64 read FWriteBack;  
property WriteThrough:Int64 read FWriteThrough;  
property WriteDirect:Int64 read FWriteDirect;  
 
property HitCount:Int64 read FHitCount;  
property MissCount:Int64 read FMissCount;  
 
property FailCount:Int64 read FFailCount;  
property SuccessCount:Int64 read FSuccessCount;  
 
property FlushCount:Int64 read FFlushCount;  
property DiscardCount:Int64 read FDiscardCount;  
property UnknownCount:Int64 read FUnknownCount;  
 
function OpenCache(ACacheSize,APageSize:LongWord; ACacheMode:TCacheMode):Boolean;  
function CloseCache:Boolean;  
 
function DeviceRead(ADevice:TDiskDevice; ASector:LongWord; ACount:Word; var ABuffer):Boolean;  
function DeviceErase(ADevice:TDiskDevice; ASector:LongWord; ACount:Word):Boolean;  
 
function GetDevicePage(ADevice:TDiskDevice; ASector:LongWord):TCachePage; virtual;  
function GetEmptyPage:TCachePage;  
 
function AllocDevicePage(ADevice:TDiskDevice; ASector:LongWord; AWrite:Boolean):TCachePage; virtual;  
 
function DiscardPage(APage:TCachePage):Boolean;  
function DiscardCache(AFirst,AAll:Boolean):Boolean;  
 
function ReleaseDevicePages(ADevice:TDiskDevice):Boolean;  
 
function FlushPage(APage:TCachePage):Boolean;  
function FlushPageEx(APage:TCachePage):Boolean;  
function FlushCache(AFirst,AAll:Boolean):Boolean;  
 
function CheckTimer:Boolean;  
function ProcessTimer:Boolean;  
 
function SchedulePage(APage:TCachePage; ATimeout:LongWord):Boolean;  
function UnschedulePage(APage:TCachePage):Boolean;  

Cache extended

TCacheEx = class(TCache)

Note: A modified version of TCache which tracks the last used page for faster repeat access. (No longer used)
 
constructor Create(ADriver:TFileSysDriver);  
destructor Destroy; override;  
private
FLastUsed:TCachePage; Most recently used Page
public
function GetDevicePage(ADevice:TDiskDevice; ASector:LongWord):TCachePage; override;  
 
function AllocDevicePage(ADevice:TDiskDevice; ASector:LongWord; AWrite:Boolean):TCachePage; override;  

Hash cache

THashCache = class(TObject)

Note: A block cache with hash keys for faster page lookup.
 
constructor Create(ADriver:TFileSysDriver);  
destructor Destroy; override;  
private
FDriver:TFileSysDriver;  
 
FLock:TCriticalSectionHandle;  
 
FKeyBits:Byte;  
FKeyMask:LongWord;  
FKeyBuckets:Pointer;  
 
FBuffer:Pointer;  
FPageSize:LongWord;  
FPageCount:LongWord;  
FCacheSize:LongWord;  
FCacheKeys:LongWord;  
FCacheMode:TCacheMode;  
FCacheState:TCacheState;  
FFlushTimeout:LongWord;  
FDiscardTimeout:LongWord;  
 
FReadCached:Int64;  
FReadDirect:Int64;  
 
FWriteBack:Int64;  
FWriteThrough:Int64;  
FWriteDirect:Int64;  
 
FHitCount:Int64;  
FMissCount:Int64;  
 
FFailCount:Int64;  
FSuccessCount:Int64;  
 
FFlushCount:Int64;  
FDiscardCount:Int64;  
FUnknownCount:Int64;  
 
FFirstPage:TCachePage; First Cache Page (Any State)
FLastPage:TCachePage; Last Cache Page (Any State)
FFirstEmpty:TCachePage; First Free Page
FLastEmpty:TCachePage; Last Free Page
FFirstClean:TCachePage; First Clean Page (Used with no Write pending)
FLastClean:TCachePage; Last Clean Page (Used with no Write pending)
FFirstDirty:TCachePage; First Dirty Page (Used with Write pending)
FLastDirty:TCachePage; Last Dirty Page (Used with Write pending)
 
FTimer:THashCacheTimer;  
FThread:THashCacheThread;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function AddPage(APage:TCachePage):Boolean;  
function RemovePage(APage:TCachePage):Boolean;  
function AddEmpty(APage:TCachePage):Boolean;  
function AddClean(APage:TCachePage):Boolean;  
function AddDirty(APage:TCachePage):Boolean;  
function AddUnknown(APage:TCachePage):Boolean;  
 
function UpdateClean(APage:TCachePage):Boolean;  
function UpdateDirty(APage:TCachePage):Boolean;  
 
function RoundPageSize(APageSize:LongWord):LongWord;  
function RoundCacheSize(ACacheSize,APageSize:LongWord):LongWord;  
function AdjustCacheKeys(ACacheKeys:LongWord):LongWord;  
 
function CalculatePageCount(ADevice:TDiskDevice):Word;  
function CalculatePageShift(ADevice:TDiskDevice):Word;  
function CalculatePageMask(ADevice:TDiskDevice):LongWord;  
 
function KeyLink(APage:THashCachePage):Boolean;  
function KeyUnlink(APage:THashCachePage):Boolean;  
function KeyFirst(AKeyHash:LongWord):THashCachePage;  
 
function LinkPage(APage:TCachePage):Boolean;  
function UnlinkPage(APage:TCachePage):Boolean;  
function LinkEmpty(APage:TCachePage):Boolean;  
function UnlinkEmpty(APage:TCachePage):Boolean;  
function LinkClean(APage:TCachePage):Boolean;  
function UnlinkClean(APage:TCachePage):Boolean;  
function LinkDirty(APage:TCachePage):Boolean;  
function UnlinkDirty(APage:TCachePage):Boolean;  
public
property PageSize:LongWord read FPageSize;  
property PageCount:LongWord read FPageCount;  
property CacheSize:LongWord read FCacheSize;  
property CacheKeys:LongWord read FCacheKeys;  
property CacheMode:TCacheMode read FCacheMode;  
property CacheState:TCacheState read FCacheState;  
property FlushTimeout:LongWord read FFlushTimeout;  
property DiscardTimeout:LongWord read FDiscardTimeout;  
 
property ReadCached:Int64 read FReadCached;  
property ReadDirect:Int64 read FReadDirect;  
 
property WriteBack:Int64 read FWriteBack;  
property WriteThrough:Int64 read FWriteThrough;  
property WriteDirect:Int64 read FWriteDirect;  
 
property HitCount:Int64 read FHitCount;  
property MissCount:Int64 read FMissCount;  
 
property FailCount:Int64 read FFailCount;  
property SuccessCount:Int64 read FSuccessCount;  
 
property FlushCount:Int64 read FFlushCount;  
property DiscardCount:Int64 read FDiscardCount;  
property UnknownCount:Int64 read FUnknownCount;  
 
function OpenCache(ACacheSize,ACacheKeys,APageSize:LongWord; ACacheMode:TCacheMode):Boolean;  
function CloseCache:Boolean;  
 
function DeviceRead(ADevice:TDiskDevice; ASector:LongWord; ACount:Word; var ABuffer):Boolean;  
function DeviceWrite(ADevice:TDiskDevice; ASector:LongWord; ACount:Word; const ABuffer):Boolean;  
function DeviceErase(ADevice:TDiskDevice; ASector:LongWord; ACount:Word):Boolean;  
 
function GetDevicePage(ADevice:TDiskDevice; ASector:LongWord):TCachePage; virtual;  
function GetEmptyPage:TCachePage;  
 
function AllocDevicePage(ADevice:TDiskDevice; ASector:LongWord; AWrite:Boolean):TCachePage; virtual;  
 
function DiscardPage(APage:TCachePage):Boolean;  
function DiscardCache(AFirst,AAll:Boolean):Boolean;  
 
function ReleaseDevicePages(ADevice:TDiskDevice):Boolean;  
 
function FlushPage(APage:TCachePage):Boolean;  
function FlushPageEx(APage:TCachePage):Boolean;  
function FlushCache(AFirst,AAll:Boolean):Boolean;  
 
function CheckTimer:Boolean;  
function ProcessTimer:Boolean;  
 
function SchedulePage(APage:TCachePage; ATimeout:LongWord):Boolean;  
function UnschedulePage(APage:TCachePage):Boolean;  

Incremental cache

TIncrementalCache = class(TObject)

Note: An expanded THashCache with incremental read ahead and dirty region write back.
 
constructor Create(ADriver:TFileSysDriver);  
destructor Destroy; override;  
private
FDriver:TFileSysDriver;  
 
FLock:TCriticalSectionHandle;  
 
FKeyBits:Byte;  
FKeyMask:LongWord;  
FKeyBuckets:Pointer;  
 
FBuffer:Pointer;  
FPageSize:LongWord;  
FPageCount:LongWord;  
FCacheSize:LongWord;  
FCacheKeys:LongWord;  
FCacheMode:TCacheMode;  
FCacheState:TCacheState;  
FFlushTimeout:LongWord;  
FDiscardTimeout:LongWord;  
 
FReadCached:Int64;  
FReadDirect:Int64;  
 
FWriteBack:Int64;  
FWriteThrough:Int64;  
FWriteDirect:Int64;  
 
FHitCount:Int64;  
FMissCount:Int64;  
 
FFailCount:Int64;  
FSuccessCount:Int64;  
 
FFlushCount:Int64;  
FDiscardCount:Int64;  
FUnknownCount:Int64;  
 
FFirstPage:TCachePage; First Cache Page (Any State)
FLastPage:TCachePage; Last Cache Page (Any State)
FFirstEmpty:TCachePage; First Free Page
FLastEmpty:TCachePage; Last Free Page
FFirstClean:TCachePage; First Clean Page (Used with no Write pending)
FLastClean:TCachePage; Last Clean Page (Used with no Write pending)
FFirstDirty:TCachePage; First Dirty Page (Used with Write pending)
FLastDirty:TCachePage; Last Dirty Page (Used with Write pending)
 
FTimer:TIncrementalCacheTimer;  
FThread:TIncrementalCacheThread;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function AddPage(APage:TCachePage):Boolean;  
function RemovePage(APage:TCachePage):Boolean;  
function AddEmpty(APage:TCachePage):Boolean;  
function AddClean(APage:TCachePage):Boolean;  
function AddDirty(APage:TCachePage):Boolean;  
function AddUnknown(APage:TCachePage):Boolean;  
 
function UpdateClean(APage:TCachePage):Boolean;  
function UpdateDirty(APage:TCachePage):Boolean;  
 
function RoundPageSize(APageSize:LongWord):LongWord;  
function RoundCacheSize(ACacheSize,APageSize:LongWord):LongWord;  
function AdjustCacheKeys(ACacheKeys:LongWord):LongWord;  
 
function CalculatePageCount(ADevice:TDiskDevice):Word;  
function CalculatePageShift(ADevice:TDiskDevice):Word;  
function CalculatePageMask(ADevice:TDiskDevice):LongWord;  
 
function KeyLink(APage:THashCachePage):Boolean;  
function KeyUnlink(APage:THashCachePage):Boolean;  
function KeyFirst(AKeyHash:LongWord):THashCachePage;  
 
function LinkPage(APage:TCachePage):Boolean;  
function UnlinkPage(APage:TCachePage):Boolean;  
function LinkEmpty(APage:TCachePage):Boolean;  
function UnlinkEmpty(APage:TCachePage):Boolean;  
function LinkClean(APage:TCachePage):Boolean;  
function UnlinkClean(APage:TCachePage):Boolean;  
function LinkDirty(APage:TCachePage):Boolean;  
function UnlinkDirty(APage:TCachePage):Boolean;  
 
function PrepareDeviceRead(ADevice:TDiskDevice; APage:TCachePage; var ASector:LongWord; var ACount:Word):Boolean;  
function PrepareDeviceWrite(ADevice:TDiskDevice; APage:TCachePage; var ASector:LongWord; var ACount:Word):Boolean;  
public
property PageSize:LongWord read FPageSize;  
property PageCount:LongWord read FPageCount;  
property CacheSize:LongWord read FCacheSize;  
property CacheKeys:LongWord read FCacheKeys;  
property CacheMode:TCacheMode read FCacheMode;  
property CacheState:TCacheState read FCacheState;  
property FlushTimeout:LongWord read FFlushTimeout;  
property DiscardTimeout:LongWord read FDiscardTimeout;  
 
property ReadCached:Int64 read FReadCached;  
property ReadDirect:Int64 read FReadDirect;  
 
property WriteBack:Int64 read FWriteBack;  
property WriteThrough:Int64 read FWriteThrough;  
property WriteDirect:Int64 read FWriteDirect;  
 
property HitCount:Int64 read FHitCount;  
property MissCount:Int64 read FMissCount;  
 
property FailCount:Int64 read FFailCount;  
property SuccessCount:Int64 read FSuccessCount;  
 
property FlushCount:Int64 read FFlushCount;  
property DiscardCount:Int64 read FDiscardCount;  
property UnknownCount:Int64 read FUnknownCount;  
 
function OpenCache(ACacheSize,ACacheKeys,APageSize:LongWord; ACacheMode:TCacheMode):Boolean;  
function CloseCache:Boolean;  
 
function DeviceRead(ADevice:TDiskDevice; ASector:LongWord; ACount:Word; var ABuffer):Boolean;  
function DeviceWrite(ADevice:TDiskDevice; ASector:LongWord; ACount:Word; const ABuffer):Boolean;  
function DeviceErase(ADevice:TDiskDevice; ASector:LongWord; ACount:Word):Boolean;  
 
function GetDevicePage(ADevice:TDiskDevice; ASector:LongWord):TCachePage; virtual;  
function GetEmptyPage:TCachePage;  
 
function AllocDevicePage(ADevice:TDiskDevice; ASector:LongWord; AWrite:Boolean):TCachePage; virtual;  
 
function DiscardPage(APage:TCachePage):Boolean;  
function DiscardCache(AFirst,AAll:Boolean):Boolean;  
 
function ReleaseDevicePages(ADevice:TDiskDevice):Boolean;  
 
function FlushPage(APage:TCachePage):Boolean;  
function FlushPageEx(APage:TCachePage):Boolean;  
function FlushCache(AFirst,AAll:Boolean):Boolean;  
 
function CheckTimer:Boolean;  
function ProcessTimer:Boolean;  
 
function SchedulePage(APage:TCachePage; ATimeout:LongWord):Boolean;  
function UnschedulePage(APage:TCachePage):Boolean;  

Cache page

TCachePage = class(TObject)

constructor Create;  
destructor Destroy; override;  
private
FDevice:TDiskDevice;  
 
FData:Pointer;  
 
FSector:LongWord;  
FCount:Word;  
 
FPageTime:Int64; Time Page was Allocated from Empty (Ticks)
FWriteTime:Int64; Time Page was Allocated to Dirty (Ticks)
FPageType:TCachePageType;  
FPageState:TCachePageState;  
 
FPrevPage:TCachePage; Previous page in Page list
FNextPage:TCachePage; Next page in Page list
 
FPrevLink:TCachePage; Previous page in Empty/Clean/Dirty list
FNextLink:TCachePage; Next page in Empty/Clean/Dirty list
public
property Device:TDiskDevice read FDevice write FDevice;  
 
property Data:Pointer read FData write FData;  
 
property Sector:LongWord read FSector write FSector;  
property Count:Word read FCount write FCount;  
 
property PageTime:Int64 read FPageTime write FPageTime;  
property WriteTime:Int64 read FWriteTime write FWriteTime;  
property PageType:TCachePageType read FPageType write FPageType;  
property PageState:TCachePageState read FPageState write FPageState;  
 
property PrevPage:TCachePage read FPrevPage write FPrevPage;  
property NextPage:TCachePage read FNextPage write FNextPage;  
 
property PrevLink:TCachePage read FPrevLink write FPrevLink;  
property NextLink:TCachePage read FNextLink write FNextLink;  

Hash cache page

THashCachePage = class(TCachePage)

private
FKeyHash:LongWord;  
FKeyPrev:THashCachePage;  
FKeyNext:THashCachePage;  
public
property KeyHash:LongWord read FKeyHash write FKeyHash;  
property KeyPrev:THashCachePage read FKeyPrev write FKeyPrev;  
property KeyNext:THashCachePage read FKeyNext write FKeyNext;  

Incremental cache page

TIncrementalCachePage = class(THashCachePage)

private
FReadSector:LongWord;  
FReadCount:Word;  
 
FDirtySector:LongWord;  
FDirtyCount:Word;  
public
property ReadSector:LongWord read FReadSector write FReadSector;  
property ReadCount:Word read FReadCount write FReadCount;  
 
property DirtySector:LongWord read FDirtySector write FDirtySector;  
property DirtyCount:Word read FDirtyCount write FDirtyCount;  
 
function ReadData:Pointer;  
function DirtyData:Pointer;  

Cache timer

TCacheTimer = class(TObject)

constructor Create(ACache:TCache);  
destructor Destroy; override;  
protected
FCache:TCache;  
 
FLock:TMutexHandle;  
FInterval:LongWord;  
FCheckTimer:TTimerHandle;  
FProcessSemaphore:TSemaphoreHandle;  
 
FFirst:PCacheTimerItem;  
FLast:PCacheTimerItem;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function Dequeue(AMax:Integer):TCachePage;  
 
function FirstKey:Integer;  
function InsertKey(APage:TCachePage; AKey:Integer):Boolean;  
function DeleteKey(APage:TCachePage):Boolean;  
function DecrementKey:Integer;  
public
function StartTimer(AInterval:LongWord):Boolean;  
function StopTimer:Boolean;  
 
function CheckTimer:Boolean;  
function ProcessTimer:Boolean;  
 
function SchedulePage(APage:TCachePage; ATimeout:LongWord):Boolean;  
function UnschedulePage(APage:TCachePage):Boolean;  

Hash cache timer

THashCacheTimer = class(TObject)

constructor Create(ACache:THashCache);  
destructor Destroy; override;  
protected
FCache:THashCache;  
 
FLock:TMutexHandle;  
FInterval:LongWord;  
FCheckTimer:TTimerHandle;  
FProcessSemaphore:TSemaphoreHandle;  
 
FFirst:PCacheTimerItem;  
FLast:PCacheTimerItem;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function Dequeue(AMax:Integer):TCachePage;  
 
function FirstKey:Integer;  
function InsertKey(APage:TCachePage; AKey:Integer):Boolean;  
function DeleteKey(APage:TCachePage):Boolean;  
function DecrementKey:Integer;  
public
function StartTimer(AInterval:LongWord):Boolean;  
function StopTimer:Boolean;  
 
function CheckTimer:Boolean;  
function ProcessTimer:Boolean;  
 
function SchedulePage(APage:TCachePage; ATimeout:LongWord):Boolean;  
function UnschedulePage(APage:TCachePage):Boolean;  

Incremental cache timer

TIncrementalCacheTimer = class(TObject)

constructor Create(ACache:TIncrementalCache);  
destructor Destroy; override;  
protected
FCache:TIncrementalCache;  
 
FLock:TMutexHandle;  
FInterval:LongWord;  
FCheckTimer:TTimerHandle;  
FProcessSemaphore:TSemaphoreHandle;  
 
FFirst:PCacheTimerItem;  
FLast:PCacheTimerItem;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function Dequeue(AMax:Integer):TCachePage;  
 
function FirstKey:Integer;  
function InsertKey(APage:TCachePage; AKey:Integer):Boolean;  
function DeleteKey(APage:TCachePage):Boolean;  
function DecrementKey:Integer;  
public
function StartTimer(AInterval:LongWord):Boolean;  
function StopTimer:Boolean;  
 
function CheckTimer:Boolean;  
function ProcessTimer:Boolean;  
 
function SchedulePage(APage:TCachePage; ATimeout:LongWord):Boolean;  
function UnschedulePage(APage:TCachePage):Boolean;  

Cache thread

TCacheThread = class(TThread)

constructor Create(ACache:TCache);  
destructor Destroy; override;  
protected
FCache:TCache;  
 
procedure Execute; override;  

Hash cache thread

THashCacheThread = class(TThread)

constructor Create(ACache:THashCache);  
destructor Destroy; override;  
protected
FCache:THashCache;  
 
procedure Execute; override;  

Incremental cache thread

TIncrementalCacheThread = class(TThread)

constructor Create(ACache:TIncrementalCache);  
destructor Destroy; override;  
protected
FCache:TIncrementalCache;  
 
procedure Execute; override;  

Entry timer

TEntryTimer = class(TObject)

constructor Create(ADriver:TFileSysDriver);  
destructor Destroy; override;  
protected
FDriver:TFileSysDriver;  
 
FLock:TMutexHandle;  
FInterval:LongWord;  
FCheckTimer:TTimerHandle;  
FProcessTimer:TTimerHandle;  
 
FFirst:PEntryTimerItem;  
FLast:PEntryTimerItem;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function Dequeue:TDiskEntry;  
 
function FirstKey:Integer;  
function InsertKey(AEntry:TDiskEntry; AKey:Integer):Boolean;  
function DeleteKey(AEntry:TDiskEntry):Boolean;  
function DecrementKey:Integer;  
public
function StartTimer(AInterval:LongWord):Boolean;  
function StopTimer:Boolean;  
 
function CheckTimer:Boolean;  
function ProcessTimer:Boolean;  
 
function ScheduleEntry(AEntry:TDiskEntry; ATimeout:LongWord):Boolean;  
function UnscheduleEntry(AEntry:TDiskEntry):Boolean;  

Default recognizer

TDefaultRecognizer = class(TRecognizer)

constructor Create(ADriver:TFileSysDriver);  
protected
function GetName:String; override;  
public
function RecognizePartitionId(APartitionId:Byte):Boolean; override;  
 
function RecognizePartition(APartition:TDiskPartition):Boolean; override;  

Default partitioner

TDefaultPartitioner = class(TDiskPartitioner)

constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);  
public
function AcceptPartition(ADevice:TDiskDevice; APartition,AParent:TDiskPartition; APartitionId:Byte):Boolean; override;  

Extended disk controller

TExtDiskController = class(TDiskController)

protected
function GetCylinders(ADevice:TDiskDevice):LongWord;  
function GetHeads(ADevice:TDiskDevice):LongWord;  
function GetSectors(ADevice:TDiskDevice):LongWord;  
function GetLogicalShiftCount(ADevice:TDiskDevice):Word;  

ATA disk controller

TATADiskController = class(TDiskController)

constructor Create(ADriver:TFileSysDriver);  
public
function ControllerInit:Boolean; override;  
 
function LocateDevices:Boolean; override;  

ATAPI disk controller

TATAPIDiskController = class(TDiskController)

constructor Create(ADriver:TFileSysDriver);  
public
function ControllerInit:Boolean; override;  
 
function LocateDevices:Boolean; override;  

SCSI disk contoller

TSCSIDiskController = class(TDiskController)

constructor Create(ADriver:TFileSysDriver);  
public
function ControllerInit:Boolean; override;  
 
function LocateDevices:Boolean; override;  

USB disk controller

TUSBDiskController = class(TExtDiskController)

constructor Create(ADriver:TFileSysDriver);  
public
function ControllerInit:Boolean; override;  
 
function LocateDevices:Boolean; override;  
 
function Read(ADevice:TDiskDevice; ASector:LongWord; ACount:Word; var ABuffer):Boolean; override;  
function Write(ADevice:TDiskDevice; ASector:LongWord; ACount:Word; const ABuffer):Boolean; override;  
 
function Reset(ADevice:TDiskDevice):Boolean; override;  
 
function LockMedia(ADevice:TDiskDevice):Boolean; override;  
function UnlockMedia(ADevice:TDiskDevice):Boolean; override;  
function EjectMedia(ADevice:TDiskDevice):Boolean; override;  
 
function MediaReady(ADevice:TDiskDevice):Boolean; override;  
function MediaChanged(ADevice:TDiskDevice):Boolean; override;  
function MediaLocked(ADevice:TDiskDevice):Boolean; override;  
 
function Information(ADevice:TDiskDevice):String; override;  
 
function VendorId(ADevice:TDiskDevice):Word; override;  
function DeviceId(ADevice:TDiskDevice):Word; override;  
 
function Manufacturer(ADevice:TDiskDevice):String; override;  
function Product(ADevice:TDiskDevice):String; override;  
function SerialNumber(ADevice:TDiskDevice):String; override;  
 
function LogicalUnitNo(ADevice:TDiskDevice):LongWord; override;  
 
function LBA(ADevice:TDiskDevice):Boolean; override;  
 
function MediaType(ADevice:TDiskDevice):TMediaType; override;  
function FloppyType(ADevice:TDiskDevice):TFloppyType; override;  
function Ready(ADevice:TDiskDevice):Boolean; override;  
function Locked(ADevice:TDiskDevice):Boolean; override;  
function Lockable(ADevice:TDiskDevice):Boolean; override;  
function Ejectable(ADevice:TDiskDevice):Boolean; override;  
function Readable(ADevice:TDiskDevice):Boolean; override;  
function Writeable(ADevice:TDiskDevice):Boolean; override;  
function Removable(ADevice:TDiskDevice):Boolean; override;  
function ChangeLine(ADevice:TDiskDevice):Boolean; override;  
 
function PhysicalCylinders(ADevice:TDiskDevice):LongWord; override;  
function PhysicalHeads(ADevice:TDiskDevice):LongWord; override;  
function PhysicalSectors(ADevice:TDiskDevice):LongWord; override;  
 
function LogicalCylinders(ADevice:TDiskDevice):LongWord; override;  
function LogicalHeads(ADevice:TDiskDevice):LongWord; override;  
function LogicalSectors(ADevice:TDiskDevice):LongWord; override;  
 
function SectorSize(ADevice:TDiskDevice):Word; override;  
function SectorCount(ADevice:TDiskDevice):Int64; override;  

MMC disk controller

TMMCDiskController = class(TExtDiskController)

constructor Create(ADriver:TFileSysDriver);  
public
function ControllerInit:Boolean; override;  
 
function LocateDevices:Boolean; override;  
 
function Read(ADevice:TDiskDevice; ASector:LongWord; ACount:Word; var ABuffer):Boolean; override;  
function Write(ADevice:TDiskDevice; ASector:LongWord; ACount:Word; const ABuffer):Boolean; override;  
function Erase(ADevice:TDiskDevice; ASector:LongWord; ACount:Word):Boolean; override;  
 
function Reset(ADevice:TDiskDevice):Boolean; override;  
 
function LockMedia(ADevice:TDiskDevice):Boolean; override;  
function UnlockMedia(ADevice:TDiskDevice):Boolean; override;  
function EjectMedia(ADevice:TDiskDevice):Boolean; override;  
 
function MediaReady(ADevice:TDiskDevice):Boolean; override;  
function MediaChanged(ADevice:TDiskDevice):Boolean; override;  
function MediaLocked(ADevice:TDiskDevice):Boolean; override;  
 
function Information(ADevice:TDiskDevice):String; override;  
 
function VendorId(ADevice:TDiskDevice):Word; override;  
function DeviceId(ADevice:TDiskDevice):Word; override;  
 
function Manufacturer(ADevice:TDiskDevice):String; override;  
function Product(ADevice:TDiskDevice):String; override;  
function SerialNumber(ADevice:TDiskDevice):String; override;  
 
function LogicalUnitNo(ADevice:TDiskDevice):LongWord; override;  
 
function LBA(ADevice:TDiskDevice):Boolean; override;  
 
function MediaType(ADevice:TDiskDevice):TMediaType; override;  
function FloppyType(ADevice:TDiskDevice):TFloppyType; override;  
function Ready(ADevice:TDiskDevice):Boolean; override;  
function Locked(ADevice:TDiskDevice):Boolean; override;  
function Lockable(ADevice:TDiskDevice):Boolean; override;  
function Ejectable(ADevice:TDiskDevice):Boolean; override;  
function Readable(ADevice:TDiskDevice):Boolean; override;  
function Writeable(ADevice:TDiskDevice):Boolean; override;  
function Eraseable(ADevice:TDiskDevice):Boolean; override;  
function Removable(ADevice:TDiskDevice):Boolean; override;  
function ChangeLine(ADevice:TDiskDevice):Boolean; override;  
 
function PhysicalCylinders(ADevice:TDiskDevice):LongWord; override;  
function PhysicalHeads(ADevice:TDiskDevice):LongWord; override;  
function PhysicalSectors(ADevice:TDiskDevice):LongWord; override;  
 
function LogicalCylinders(ADevice:TDiskDevice):LongWord; override;  
function LogicalHeads(ADevice:TDiskDevice):LongWord; override;  
function LogicalSectors(ADevice:TDiskDevice):LongWord; override;  
 
function SectorSize(ADevice:TDiskDevice):Word; override;  
function SectorCount(ADevice:TDiskDevice):Int64; override;  

File system handle stream

TFSHandleStream = class(TStream)

constructor Create(AHandle:Integer);  
private
FHandle:Integer;  
protected
procedure SetSize(NewSize:LongInt); override;  
public
function Read(var Buffer; Count:LongInt):LongInt; override;  
function Write(const Buffer; Count:LongInt):LongInt; override;  
function Seek(Offset:LongInt; Origin:Word):LongInt; override;  
property Handle:Integer read FHandle;  

File system file stream

TFSFileStream = class(TFSHandleStream)

constructor Create(const FileName:String; Mode:Word);  
destructor Destroy; override;  
private
 
public
 

File system handle stream extended

TFSHandleStreamEx = class(TStreamEx)

constructor Create(AHandle:Integer);  
private
FHandle:Integer;  
protected
procedure SetSize(NewSize:LongInt); override;  
procedure SetSizeEx(const NewSize:Int64); override;  
public
function Read(var Buffer; Count:LongInt):LongInt; override;  
function Write(const Buffer; Count:LongInt):LongInt; override;  
function Seek(Offset:LongInt; Origin:Word):LongInt; override;  
function SeekEx(const Offset:Int64; Origin:Word):Int64; override;  
property Handle:Integer read FHandle;  

File system file stream extended

TFSFileStreamEx = class(TFSHandleStreamEx)

constructor Create(const FileName:String; Mode:Word);  
destructor Destroy; override;  
private
 
public
 


Public variables



FileSystem logging

FILESYS_DEFAULT_LOG_LEVEL:LongWord = FILESYS_LOG_LEVEL_DEBUG; Minimum level for FileSystem messages. Only messages with level greater than or equal to this will be printed.
FILESYS_LOG_ENABLED:Boolean;

FileSystem specific variables

FileSysDriver:TFileSysDriver;


Function declarations



Initialization functions

procedure FileSysInit;
Description: To be documented
Note None documented


function FileSysStart:LongWord;
Description: To be documented
Note None documented


function FileSysStop:LongWord;
Description: To be documented
Note None documented


procedure FileSysAsyncStart(Data:Pointer);
Description: To be documented
Note None documented


FileSystem functions (Delphi/FreePascal RTL Equivalent)

Drive functions

function FSGetPathDrive(const APath:String):Byte; inline;
Description: To be documented
Note No Volume Support


function FSGetDriveType(ADrive:Byte):TDriveType; inline;
Description: To be documented
Note No Volume Support


function FSGetDriveData(ADrive:Byte):TDriveData; inline;
Description: To be documented
Note No Volume Support


function FSGetDriveAttr(ADrive:Byte):LongWord; inline;
Description: To be documented
Note No Volume Support


function FSGetDriveLabel(ADrive:Byte):String; inline;
Description: To be documented
Note No Volume Support


function FSSetDriveLabel(ADrive:Byte; const ALabel:String):Boolean; inline;
Description: To be documented
Note No Volume Support


function FSGetDriveSerial(ADrive:Byte):LongWord; inline;
Description: To be documented
Note No Volume Support


function FSSetDriveSerial(ADrive:Byte; ASerial:LongWord):Boolean; inline;
Description: To be documented
Note No Volume Support


function FSIsDriveValid(ADrive:Byte):Boolean; inline;
Description: To be documented
Note No Volume Support


function FSGetValidDrives:LongWord; inline;
Description: To be documented
Note No Volume Support


function FSGetValidDriveNames:TStringList; inline;
Description: To be documented
Note No Volume Support


function FSGetValidDriveStrings:String; inline;
Description: To be documented
Note No Volume Support


function FSGetDriveFreeSpace(ADrive:Byte):LongWord; inline;
Description: To be documented
Note No Volume Support


function FSGetDriveFreeSpaceEx(ADrive:Byte):Int64; inline;
Description: To be documented
Note No Volume Support


function FSGetDriveTotalSpace(ADrive:Byte):LongWord; inline;
Description: To be documented
Note No Volume Support


function FSGetDriveTotalSpaceEx(ADrive:Byte):Int64; inline;
Description: To be documented
Note No Volume Support


function FSGetDriveInformation(const APath:String; var AClusterSize:LongWord; var ATotalClusterCount,AFreeClusterCount:Int64):Boolean; inline;
Description: To be documented
Note None documented


function FSGetCurrentDrive:Byte; inline;
Description: To be documented
Note No Volume Support


function FSSetCurrentDrive(const ADrive:String):Boolean; inline;
Description: To be documented
Note No Volume Support


File functions

function FSFileOpen(const AFileName:String; AMode:Integer):Integer; inline;
Description: To be documented
Note None documented


function FSFileCreate(const AFileName:String):Integer; inline;
Description: To be documented
Note None documented


function FSDeleteFile(const AFileName:String):Boolean; inline;
Description: To be documented
Note None documented


procedure FSFileClose(AHandle:Integer); inline;
Description: To be documented
Note None documented


function FSRenameFile(const AOldName,ANewName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSFileSeek(AHandle,AOffset,AOrigin:Integer):Integer; inline;
Description: To be documented
Note None documented


function FSFileFlush(AHandle:Integer):Boolean; inline;
Description: To be documented
Note None documented


function FSFileTruncate(AHandle:Integer):Boolean; inline;
Description: To be documented
Note None documented


function FSSetEndOfFile(AHandle:THandle):Boolean; inline;
Description: To be documented
Note None documented


function FSEndOfFile(AHandle:Integer):Boolean; inline;
Description: To be documented
Note None documented


function FSFilePos(AHandle:Integer):Integer; inline;
Description: To be documented
Note None documented


function FSFileSize(AHandle:Integer):Integer; inline;
Description: To be documented
Note None documented


function FSFileAge(const AFileName:String):Integer; inline;
Description: To be documented
Note None documented


function FSFileExists(const AFileName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSFileGetAttr(const AFileName:String):Integer; inline;
Description: To be documented
Note None documented


function FSFileGetDate(AHandle:Integer):Integer; inline;
Description: To be documented
Note None documented


function FSFileSetAttr(const AFileName:String; AAttr:Integer):Integer; inline;
Description: To be documented
Note None documented


function FSFileSetDate(AHandle:Integer; AAge:Integer):Integer; inline;
Description: To be documented
Note None documented


function FSFileRead(AHandle:Integer; var ABuffer; ACount:Integer):Integer; inline;
Description: To be documented
Note None documented


function FSFileWrite(AHandle:Integer; const ABuffer; ACount:Integer):Integer; inline;
Description: To be documented
Note None documented


Directory functions

function FSCreateDir(const ADirName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSRemoveDir(const ADirName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSRenameDir(const AOldName,ANewName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSGetCurrentDir:String; inline;
Description: To be documented
Note No Volume Support


function FSSetCurrentDir(const ADirName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSDirectoryExists(const ADirName:String):Boolean; inline;
Description: To be documented
Note None documented


procedure FSForceDirectories(ADirName:String); inline;
Description: To be documented
Note None documented


procedure FSDeleteTree(const ADirName:String); inline;
Description: To be documented
Note None documented


Search functions

function FSFindFirst(const APath:String; AAttr:Integer; var ASearchRec:TSearchRec):Integer; inline;
Description: To be documented
Note None documented


function FSFindNext(var ASearchRec:TSearchRec):Integer; inline;
Description: To be documented
Note None documented


procedure FSFindClose(var ASearchRec:TSearchRec); inline;
Description: To be documented
Note None documented


Additional functions

function FSFileCopy(const ASourceFile,ADestFile:String; AFailIfExists:Boolean):Boolean; inline;
Description: To be documented
Note None documented


function FSFileCopyEx(const ASourceFile,ADestFile:String; AFailIfExists:Boolean; AUseSourceDate:Boolean; ADestDate:Integer; AUseSourceAttr:Boolean; ADestAttr:Integer):Boolean; inline;
Description: To be documented
Note None documented


function FSGetShortName(const AFileName:String):String; inline;
Description: To be documented
Note None documented


function FSGetLongName(const AFileName:String):String; inline;
Description: To be documented
Note None documented


function FSGetTrueName(const AFileName:String):String; inline;
Description: To be documented
Note None documented


Extended functions

function FSFileSeekEx(AHandle:Integer; const AOffset:Int64; AOrigin:Integer):Int64; inline;
Description: To be documented
Note None documented


function FSEndOfFileEx(AHandle:Integer):Boolean; inline;
Description: To be documented
Note None documented


function FSFilePosEx(AHandle:Integer):Int64; inline;
Description: To be documented
Note None documented


function FSFileSizeEx(AHandle:THandle):Int64; inline;
Description: To be documented
Note None documented


function FSFileAgeEx(const AFileName:String):TFileTime; inline;
Description: To be documented
Note None documented


function FSFileGetAttrEx(AHandle:Integer):Integer; inline;
Description: To be documented
Note None documented


function FSFileGetDateEx(AHandle:Integer):TFileTime; inline;
Description: To be documented
Note None documented


function FSFileSetDateEx(AHandle:Integer; AAge:TFileTime):Integer; inline;
Description: To be documented
Note None documented


function FSGetFileTime(AHandle:THandle; ACreateTime,AAccessTime,AWriteTime:PFileTime):Boolean; inline;
Description: To be documented
Note None documented


function FSSetFileTime(AHandle:THandle; ACreateTime,AAccessTime,AWriteTime:PFileTime):Boolean; inline;
Description: To be documented
Note None documented


function FSFindFirstEx(const APath:String; var ASearchRec:TFileSearchRec):Integer; inline;
Description: To be documented
Note None documented


function FSFindNextEx(var ASearchRec:TFileSearchRec):Integer; inline;
Description: To be documented
Note None documented


procedure FSFindCloseEx(var ASearchRec:TFileSearchRec); inline;
Description: To be documented
Note None documented


FileSystem functions (Win32 Compatibility)

Drive functions

function FSDefineDosDevice(const ADeviceName,ATargetPath:String; AFlags:LongWord):Boolean; inline;
Description: To be documented
Note None documented


function FSGetDiskType(const ARootPath:String):LongWord; inline;
Description: Equivalent to Win32 GetDriveType
Note None documented


function FSGetDiskFreeSpace(const ARootPath:String; var ASectorsPerCluster,ABytesPerSector,ANumberOfFreeClusters,ATotalNumberOfClusters:LongWord):Boolean; inline;
Description: To be documented
Note None documented


function FSGetDiskFreeSpaceEx(const APathName:String; var AFreeBytesAvailableToCaller,ATotalNumberOfBytes,ATotalNumberOfFreeBytes:Int64):Boolean; inline;
Description: To be documented
Note None documented


function FSGetLogicalDrives:LongWord; inline;
Description: To be documented
Note None documented


function FSGetLogicalDriveStrings:String; inline;
Description: To be documented
Note None documented


function FSGetVolumeInformation(const ARootPath:String; var AVolumeName:String; var AVolumeSerialNumber,AMaximumComponentLength,AFileSystemFlags:LongWord; var ASystemName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSQueryDosDevice(const ARootPath:String):String; inline;
Description: To be documented
Note None documented


function FSSetVolumeLabel(const AVolume:String; const ALabel:String):Boolean; inline;
Description: To be documented
Note None documented


File functions

function FSAreFileApisANSI:Boolean; inline;
Description: To be documented
Note None documented


function FSCloseFile(AHandle:THandle):Boolean; inline;
Description: Equivalent to Win32 CloseHandle
Note None documented


function FSCopyFile(const AExistingName,ANewName:String; AFailIfExists:Boolean):Boolean; inline;
Description: To be documented
Note None documented


function FSCreateFile(const AFileName:String; AAccessMode,AShareMode,ACreateFlags,AFileAttributes:LongWord):THandle; inline;
Description: To be documented
Note None documented


function FSFindCloseFile(AHandle:THandle):Boolean; inline;
Description: Equivalent to Win32 FindClose
Note None documented


function FSFindFirstFile(const AFileName:String; var AFindData:TWin32FindData):THandle; inline;
Description: To be documented
Note None documented


function FSFindNextFile(AHandle:THandle; var AFindData:TWin32FindData):Boolean; inline;
Description: To be documented
Note None documented


function FSFlushFileBuffers(AHandle:THandle):Boolean; inline;
Description: To be documented
Note None documented


function FSGetFileAttributes(const AFileName:String):LongWord; inline;
Description: To be documented
Note None documented


function FSGetFileInformationByHandle(AHandle:THandle; var AFileInformation:TByHandleFileInformation):Boolean; inline;
Description: To be documented
Note None documented


function FSGetFileSize(AHandle:THandle; var AFileSizeHigh:LongWord):LongWord; inline;
Description: To be documented
Note None documented


function FSGetFullPathName(const AFileName:String):String; inline;
Description: To be documented
Note None documented


function FSGetShortPathName(const ALongPath:String):String; inline;
Description: To be documented
Note None documented


function FSMoveFile(const AExistingName,ANewName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSReadFile(AHandle:THandle; var ABuffer; ABytesToRead:LongWord; var ABytesRead:LongWord):Boolean; inline;
Description: To be documented
Note None documented


function FSSetFileApisToANSI:Boolean; inline;
Description: To be documented
Note None documented


function FSSetFileApisToOEM:Boolean; inline;
Description: To be documented
Note None documented


function FSSetFileAttributes(const AFileName:String; AFileAttributes:LongWord):Boolean; inline;
Description: To be documented
Note None documented


function FSSetFilePointer(AHandle:THandle; ADistanceToMove:LongWord; var ADistanceToMoveHigh:LongWord; AMoveMethod:LongWord):LongWord; inline;
Description: To be documented
Note None documented


function FSSetFilePointerEx(AHandle:THandle; const ADistanceToMove:Int64; var ANewFilePointer:Int64; AMoveMethod:LongWord):Boolean; inline;
Description: To be documented
Note None documented


function FSWriteFile(AHandle:THandle;const ABuffer; ABytesToWrite:LongWord; var ABytesWritten:LongWord):Boolean; inline;
Description: To be documented
Note None documented


function FSGetLongPathName(const AShortPath:String):String; inline;
Description: To be documented
Note None documented


function FSSetFileShortName(const AFileName,AShortName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSSetFileShortNameEx(AHandle:THandle; const AShortName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSCreateHardLink(const ALinkName,AFileName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSCreateSymbolicLink(const ALinkName,ATargetName:String; ADirectory:Boolean):Boolean; inline;
Description: To be documented
Note None documented


Directory functions

function FSCreateDirectory(const APathName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSGetCurrentDirectory:String; inline;
Description: To be documented
Note None documented


function FSRemoveDirectory(const APathName:String):Boolean; inline;
Description: To be documented
Note None documented


function FSSetCurrentDirectory(const APathName:String):Boolean; inline;
Description: To be documented
Note None documented


RTL FileSystem functions

System file functions

procedure SystemDoClose(Handle:THandle);
Description: To be documented
Note None documented


procedure SystemDoErase(Name:PChar; NameChangeable:Boolean);
Description: To be documented
Note None documented


procedure SystemDoRename(Name1,Name2:PChar; Name1Changeable,Name2Changeable:Boolean);
Description: To be documented
Note None documented


function SystemDoWrite(Handle:THandle; Address:Pointer; Len:LongInt):LongInt;
Description: To be documented
Note None documented


function SystemDoRead(Handle:THandle; Address:Pointer; Len:LongInt):LongInt;
Description: To be documented
Note None documented


function SystemDoFilePos(Handle:THandle):LongInt;
Description: To be documented
Note None documented


procedure SystemDoSeek(Handle:THandle; Pos:LongInt);
Description: To be documented
Note None documented


function SystemDoSeekEnd(Handle:THandle):LongInt;
Description: To be documented
Note None documented


function SystemDoFileSize(Handle:THandle):LongInt;
Description: To be documented
Note None documented


procedure SystemDoTruncate(Handle:THandle; Pos:LongInt);
Description: To be documented
Note None documented


procedure SystemDoOpen(var F; Name:PFileTextRecChar; Flags:LongInt; NameChangeable:Boolean);
Description: To be documented
Note FileRec and TextRec have both Handle and Mode as the first items so they could use the same routine for opening/creating.

- When (Flags and $00100) The file will be Appended
- When (Flags and $01000) The file will be Truncated/rewritten
- When (Flags and $10000) There is no check for Close (needed for TextFiles)


System directory functions

procedure SystemDoMkDir(const Dir:RawByteString);
Description: To be documented
Note None documented


procedure SystemDoRmDir(const Dir:RawByteString);
Description: To be documented
Note None documented


procedure SystemDoChDir(const Dir:RawByteString);
Description: To be documented
Note None documented


procedure SystemDoGetDir(Drive:Byte; var Dir:RawByteString);
Description: To be documented
Note None documented


Dos disk functions

function DosDiskFree(Drive:Byte):Int64;
Description: To be documented
Note No Volume Support


function DosDiskSize(Drive:Byte):Int64;
Description: To be documented
Note No Volume Support


Dos FindFirst/FindNext functions

function DosFindMatchingFile(var f:SearchRec):Integer;
Description: Internal Only
Note None documented


function DosFindFirst(const Path:PathStr; Attr:Word; var f:SearchRec):Integer;
Description: To be documented
Note FindFirst/FindNext/FindClose - To be compatible with the DOS. FindFirst/FindNext we always allow faReadOnly and faArchive but only allow other attributes if requested. This is done by matching all files and filtering with FindMatchingFile.


function DosFindNext(var f:SearchRec):Integer;
Description: To be documented
Note None documented


procedure DosFindClose(var f:SearchRec);
Description: To be documented
Note None documented


Dos file functions

function DosGetFTime(var f; var Time:LongInt):Integer;
Description: To be documented
Note None documented


function DosSetFTime(var f; Time:LongInt):Integer;
Description: To be documented
Note None documented


function DosGetFAttr(var f; var Attr:Word):Integer;
Description: To be documented
Note None documented


function DosSetFAttr(var f; Attr:Word):Integer;
Description: To be documented
Note None documented


function DosGetShortName(var p:ShortString):Boolean;
Description: To be documented
Note None documented


function DosGetLongName(var p:ShortString):Boolean;
Description: To be documented
Note None documented


SysUtils file functions

function SysUtilsFileOpen(const FileName:RawByteString; Mode:Integer):THandle;
Description: To be documented
Note None documented


function SysUtilsFileCreate(const FileName:RawByteString):THandle;
Description: To be documented
Note None documented


function SysUtilsDeleteFile(const FileName:RawByteString):Boolean;
Description: To be documented
Note None documented


procedure SysUtilsFileClose(Handle:THandle);
Description: To be documented
Note None documented


function SysUtilsRenameFile(const OldName,NewName:RawByteString):Boolean;
Description: To be documented
Note None documented


function SysUtilsFileSeek(Handle:THandle; Offset,Origin:LongInt):LongInt;
Description: To be documented
Note None documented


function SysUtilsFileTruncate(Handle:THandle;Size:Int64):Boolean;
Description: To be documented
Note None documented


function SysUtilsFileAge(const FileName:RawByteString):LongInt;
Description: To be documented
Note None documented


function SysUtilsFileExists(const FileName:RawByteString):Boolean;
Description: To be documented
Note None documented


function SysUtilsFileGetAttr(const FileName:RawByteString):LongInt;
Description: To be documented
Note None documented


function SysUtilsFileGetDate(Handle:THandle):LongInt;
Description: To be documented
Note None documented


function SysUtilsFileSetAttr(const FileName:RawByteString; Attr:LongInt):LongInt;
Description: To be documented
Note None documented


function SysUtilsFileSetDate(Handle:THandle; Age:LongInt):LongInt;
Description: To be documented
Note None documented


function SysUtilsFileRead(Handle:THandle; out Buffer; Count:LongInt):LongInt;
Description: To be documented
Note None documented


function SysUtilsFileWrite(Handle:THandle; const Buffer; Count:LongInt):LongInt;
Description: To be documented
Note None documented


function SysUtilsFileSeekEx(Handle:THandle; Offset:Int64; Origin:LongInt):Int64;
Description: To be documented
Note None documented


function SysUtilsInternalFindFirst(const Path:RawByteString; Attr:LongInt; out SearchRec:TSearchRec; var Name:RawByteString):LongInt;
Description: To be documented
Note None documented


function SysUtilsInternalFindNext(var SearchRec:TSearchRec; var Name:RawByteString):LongInt;
Description: To be documented
Note None documented


procedure SysUtilsInternalFindClose(var Handle:THandle);
Description: To be documented
Note None documented


SysUtils disk functions

function SysUtilsDiskFree(Drive:Byte):Int64;
Description: To be documented
Note No Volume Support


function SysUtilsDiskSize(Drive:Byte):Int64;
Description: To be documented
Note No Volume Support


function SysUtilsDirectoryExists(const Directory:RawByteString):Boolean;
Description: To be documented
Note None documented


FileSystem logging functions

function FileSysLoggingStart(Logging:PLoggingDevice):LongWord;
Description: To be documented
Note None documented


function FileSysLoggingStop(Logging:PLoggingDevice):LongWord;
Description: To be documented
Note None documented


function FileSysLoggingOutput(Logging:PLoggingDevice; const Data:String):LongWord;
Description: To be documented
Note None documented


function FileSysLoggingSetTarget(Logging:PLoggingDevice; const Target:String):LongWord;
Description: To be documented
Note None documented


FileSystem helper functions

function FileSysStorageGetMediaType(Storage:PStorageDevice):TMediaType;
Description: To be documented
Note None documented


function FileSysStorageGetController(Storage:PStorageDevice):TDiskController;
Description: To be documented
Note None documented


procedure FileSysStorageDeviceAdd(Event:PStorageDeviceEvent);
Description: To be documented
Note None documented


procedure FileSysStorageDeviceInsert(Event:PStorageDeviceEvent);
Description: To be documented
Note None documented


function FileSysStorageDeviceRemove(Storage:PStorageDevice):LongWord;
Description: To be documented
Note None documented


function FileSysStorageDeviceEject(Storage:PStorageDevice):LongWord;
Description: To be documented
Note None documented


function FileSysStorageDeviceEnum(Storage:PStorageDevice; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function FileSysStorageDeviceNotify(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
Description: To be documented
Note None documented


function ComparePartitions(APartition1,APartition2:Pointer):Integer;
Description: Sort partitions in order of start sector
Note None documented


procedure FileSysLog(Level:Integer;const AText:String);
Description: To be documented
Note None documented


procedure FileSysLogInfo(const AText:String); inline;
Description: To be documented
Note None documented


procedure FileSysLogError(const AText:String); inline;
Description: To be documented
Note None documented


procedure FileSysLogDebug(const AText:String); inline;
Description: To be documented
Note None documented


procedure CacheCheckTimer(Data:Pointer);
Description: To be documented
Note None documented


procedure EntryCheckTimer(Data:Pointer);
Description: To be documented
Note None documented


procedure EntryProcessTimer(Data:Pointer);
Description: To be documented
Note None documented


function MediaTypeToString(AType:TMediaType):String;
Description: To be documented
Note None documented


function FloppyTypeToString(AType:TFloppyType):String;
Description: To be documented
Note None documented


function ImageTypeToString(AType:TImageType):String;
Description: To be documented
Note None documented


function DriveTypeToString(AType:TDriveType):String;
Description: To be documented
Note None documented


function FileSysTypeToString(AType:TFileSysType):String;
Description: To be documented
Note None documented


function StringToFileSysType(const AFileSysType:String):TFileSysType;
Description: To be documented
Note None documented


function PartitionIdToString(AId:Byte):String;
Description: To be documented
Note None documented


function StringToPartitionId(const APartitionId:String):Byte;
Description: To be documented
Note None documented


function CacheModeToString(ACacheMode:TCacheMode):String;
Description: To be documented
Note None documented


function CacheStateToString(ACacheState:TCacheState):String;
Description: To be documented
Note None documented


function CachePageTimeToDateTime(const APageTime:Int64):TDateTime;
Description: To be documented
Note None documented


Return to Unit Reference