Unit CDFS

From Ultibo.org
Revision as of 05:57, 29 May 2017 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


Ultibo CDFS interface unit

To be documented

Constants



CDFS specific constants cdfs*
cdfsIso9660 = 0;  
cdfsJoilet = 1;  
cdfsSierra = 2;  
cdfsRockRidge = 3;  
cdfsAudio = 4;  
cdfsUDF = 5;  
 
cdfsNames:array[0..5] of String = (
'CD001',  
'CD001',  
'CDROM',  
'CDAUDIO',  
 
cdfsAnyName = '*';  
cdfsDotName = '.';  
cdfsDotDotName = '..';  
cdfsVersionName = '1'; Used by version information on end of identifier (Not Used)
cdfsSeparator1Name = '.'; Dot on end of identifier when no extension exists (File only)
cdfsSeparator2Name = ';'; Used by version information on end of identifier (File only)
 
cdfsJolietMaxPath = 240; 120 (240 bytes)
cdfsJolietMaxFile = 64; (128 bytes)
cdfsISO9660MaxPath = 240;  
cdfsISO9660MaxFile = 30; 31 for Directories
 
cdfsISO9660StandardIdentifier = 'CD001';  
cdfsELTORITOSystemIdentifier = 'EL TORITO SPECIFICATION';  
 
cdfsFirstSector = 0;  
cdfsReservedSectors = 16;  
cdfsISO9660StartSector = 16;  
cdfsELTORITOBootSector = 17;  
 
cdfsISO9660StructureVersion = 1;  
cdfsISO9660DescriptorVersion = 1;  
cdfsELTORITODescriptorVersion = 1;  
 
cdfsJolietUCS2Sequence1 = #37 + #47 + #64; '%/@'
cdfsJolietUCS2Sequence2 = #37 + #47 + #67; '%/C'
cdfsJolietUCS2Sequence3 = #37 + #47 + #69; '%/E'
 
cdfsDotIdentifier = $00;  
cdfsDotDotIdentifier = $01;  
 
cdfsSeparator1Value = $2E; '.'
cdfsSeparator2Value = $3B; ';'
 
cdfsTimeStartYear = 1900; CDFS Time starts at 1900
cdfsTimeOffsetInterval = 15; Offset is in 15 minute intervals
 
cdfsNullFileTime:TFileTime = (dwLowDateTime:$00000000;dwHighDateTime:$00000000);  
 
cdfsStartCluster = 16;  
cdfsUnknownCluster = LongWord(-1);  
 
cdfsRootPathNumber = 1;  
 
cdfsPathRecordSize = 9; Minimum
cdfsExtendedRecordSize = 250; Minimum
cdfsDirectoryRecordSize = 34; Minimum
 
cdfsFileIdentifierSize = 1; Minimum
cdfsPathIdentifierSize = 1; Minimum
 
cdfsHeaderRecordSize = 32; Fixed
cdfsCatalogRecordSize = 32; Fixed
cdfsExtensionRecordSize = 32; Fixed
 
cdfsEvenSize = 0;  
cdfsUnevenSize = 1;  
 
cdfsRootRecordOffset = 156; Offset of Root Directory in Descriptor
 
cdfsInstanceFirst = 0;  
cdfsInstanceLast = Byte(-1);  
 
cdfsTableTypeMask = $00FF0000;  
cdfsTableTypeShift = 16;  
cdfsTableInstanceMask = $0000FF00;  
cdfsTableInstanceShift = 8;  
cdfsTableDescriptorMask = $000000FF;  
cdfsTableDescriptorShift = 0;  
 
cdfsBitmapUnknown = LongWord(-1);  


CDFS bitmap mask cdfsBitmapMask*
cdfsBitmapMaskBits = 64; Int64 Bitmap Masks
cdfsBitmapMaskNone = $0000000000000000; Int64 Used for fast counting of free blocks
cdfsBitmapMaskAll = $FFFFFFFFFFFFFFFF; Int64 Used for fast counting of used blocks


CDFS volume flag cdfsVolumeFlag*
cdfsVolumeFlagNone = $00;  
cdfsVolumeFlagUnregistered = $01; If set this SVD contains an unregistered escape sequence


CDFS file flag cdfsFileFlag*
cdfsFileFlagNone = $00;  
cdfsFileFlagExistence = $01; If set this file is hidden
cdfsFileFlagDirectory = $02; If set this record is a directory
cdfsFileFlagAssociated = $04; If set this file is an associated file
cdfsFileFlagRecord = $08; If set record information is recorded for this file
cdfsFileFlagProtection = $10; If set permissions are recorded for this file
cdfsFileFlagReserved1 = $20; Reserved
cdfsFileFlagReserved2 = $40; Reserved
cdfsFileFlagMore = $80; If set there are more directory records for this file


CDFS permissions cdfsPermission*
cdfsPermissionSystemRead = $0001; If set system cannot Read
cdfsPermissionSystemWrite = $0002; If set system cannot Write
cdfsPermissionSystemExecute = $0004; If set system cannot Execute
cdfsPermissionReserved1 = $0008; Reserved
cdfsPermissionOwnerRead = $0010; If set owner cannot Read
cdfsPermissionOwnerWrite = $0020; If set owner cannot Write
cdfsPermissionOwnerExecute = $0040; If set owner cannot Execute
cdfsPermissionReserved2 = $0080; Reserved
cdfsPermissionGroupRead = $0100; If set group cannot Read
cdfsPermissionGroupWrite = $0200; If set group cannot Write
cdfsPermissionGroupExecute = $0400; If set group cannot Execute
cdfsPermissionReserved3 = $0800; Reserved
cdfsPermissionOtherRead = $1000; If set other cannot Read
cdfsPermissionOtherWrite = $2000; If set other cannot Write
cdfsPermissionOtherExecute = $4000; If set other cannot Execute
cdfsPermissionReserved4 = $8000; Reserved


CDFS path table cdfsPathTable*
cdfsPathTableTypePrimary = $00;  
cdfsPathTableTypeAlternate = $01;  
cdfsPathTableTypePrimaryM = $02;  
cdfsPathTableTypeAlternateM = $03;  


CDFS volume descriptor cdfsVolumeDescriptor*
cdfsVolumeDescriptorTypeBoot = $00;  
cdfsVolumeDescriptorTypePrimary = $01;  
cdfsVolumeDescriptorTypeSupplementary = $02;  
cdfsVolumeDescriptorTypePartition = $03;  
cdfsVolumeDescriptorTypeTerminator = $FF;  


CDFS header cdfsElTorito*
cdfsElToritoHeaderId = $01;  
cdfsElToritoBootIndicator = $88;  
cdfsElToritoNoBootIndicator = $00;  
cdfsElToritoHeaderIndicator = $90; 91 if final header
cdfsElToritoHeaderTerminator = $91;  
cdfsElToritoExtensionIndicator = $44;  


CDFS signature cdfsElToritoSignature*
cdfsElToritoSignature = $AA55;  


CDFS platform Id cdfsElToritoPlatform*
cdfsElToritoPlatformIdx86 = $00;  
cdfsElToritoPlatformIdPPC = $01;  
cdfsElToritoPlatformIdMac = $02;  


CDFS media type cdfsElToritoMedia*
cdfsElToritoMediaTypeNone = $00; No Emulation
cdfsElToritoMediaType12M = $01; 1.2 meg diskette
cdfsElToritoMediaType144M = $02; 1.44 meg diskette
cdfsElToritoMediaType288M = $03; 2.88 meg diskette
cdfsElToritoMediaTypeHDD = $04; Hard Disk (drive 80)
cdfsElToritoMediaTypeMask = $0F; Values 5-F Reserved, invalid at this time
 
cdfsElToritoMediaFlagReserved = $10; Reserved, must be 0
cdfsElToritoMediaFlagContinuation = $20; Continuation Entry Follows
cdfsElToritoMediaFlagAtapi = $40; Image contains ATAPI driver
cdfsElToritoMediaFlagScsi = $80; Image contains SCSI drivers
cdfsElToritoMediaFlagMask = $F0;  


CDFS extension flag cdfsElToritoExtensionFlag*
cdfsElToritoExtensionFlagExtension = $20; Extension Record Follows


Type definitions



CDFS specific types

TCDFSType = (ctNONE,ctISO9660,ctJOLIET,ctSIERRA,ctROCKRIDGE,ctAUDIO,ctUDF);

CDFS time

PCDFSTime = ^TCDFSTime;

TCDFSTime = packed record

Note: 7 Bytes
Years:Byte; Number of years since 1900
Month:Byte; Month of the year from 1 to 12
Day:Byte; Day of the month from 1 to 31
Hour:Byte; Hour of the day from 0 to 23
Minute:Byte; Minute of the hour from 0 to 59
Second:Byte; Second of the minute from 0 to 59
Offset:ShortInt; Offset from Greenwich Mean Time in number of 15 min intervals from -48 (West) to +52 (East)

CDFS date time

PCDFSDateTime = ^TCDFSDateTime;

TCDFSDateTime = packed record

Note: 17 Bytes
Year:array[0..3] of Char; Year from 1 to 9999
Month:array[0..1] of Char; Month of the year from 1 to 12
Day:array[0..1] of Char; Day of the month from 1 to 31
Hour:array[0..1] of Char; Hour of the day from 0 to 23
Minute:array[0..1] of Char; Minute of the hour from 0 to 59
Second:array[0..1] of Char; Second of the minute from 0 to 59
Hundredths:array[0..1] of Char; Hundredths of a second
Offset:ShortInt; Offset from Greenwich Mean Time in number of 15 min intervals from -48 (West) to +52 (East)

CDFS directory record

PCDFSDirectoryRecord = ^TCDFSDirectoryRecord;

TCDFSDirectoryRecord = packed record

Note: 34 Bytes (Minimum not including padding)
RecordSize:Byte; Length of Directory Record (LEN-DR)
ExtendedSize:Byte; Extended Attribute Record Length
FirstBlock:LongWord; Location of Extent
FirstBlockM:LongWord;  
DataSize:LongWord; Data Length
DataSizeM:LongWord;  
CreateTime:TCDFSTime; Recording Date and Time
FileFlags:Byte; File Flags 8 bits
UnitSize:Byte; File Unit Size
InterleaveSize:Byte; Interleave Gap Size
SequenceNumber:Word; Volume Sequence Number
SequenceNumberM:Word;  
FileIdentifierSize:Byte; Length of File Identifier (LEN_FI)
FileIdentifier:array[0..0] of Char; File Identifier d-characters,d1-characters,SEPARATOR 1,SEPARATOR 2,(00) or (01) byte
Padding:Byte; Padding Field (00) byte (Only present if FileIdentifierSize is even (Total size would be odd))
SystemData:array[0..0] of Byte; System Use LEN_SU bytes

CDFS path record

PCDFSPathRecord = ^TCDFSPathRecord;

TCDFSPathRecord = packed record

Note: 9 Bytes (Minimum not including padding)
PathIdentifierSize:Byte; Length of Directory Identifier (LEN_DI)
ExtendedSize:Byte; Extended Attribute Record Length
FirstBlock:LongWord; Location of Extent
ParentNumber:Word; Parent Directory Number
PathIdentifier:array[0..0] of Char; Directory Identifier d-characters, d1-characters, (00) byte
Padding:Byte; Padding Field (00) byte (Only present if PathIdentifierSize is odd (Total size would be odd))

CDFS extended record

PCDFSExtendedRecord = ^TCDFSExtendedRecord;

TCDFSExtendedRecord = packed record

Note: 250 Bytes (Minimum)
OwnerId:Word; Owner Identification
OwnerIdM:Word;  
GroupId:Word; Group Identification
GroupIdM:Word;  
Permissions:Word; Permissions 16 bits
CreateTime:TCDFSDateTime; File Creation Date and Time
ModifyTime:TCDFSDateTime; File Modification Date and Time
ExpireTime:TCDFSDateTime; File Expiration Date and Time
EffectiveTime:TCDFSDateTime; File Effective Date and Time
RecordFormat:Byte; Record Format
RecordAttributes:Byte; Record Attributes
RecordLength:Word; Record Length
RecordLengthM:Word;  
SystemIdentifier:array[0..31] of Char; System Identifier a-characters, a1-characters
SystemData:array[0..63] of Byte; System Use not specified
ExtendedVersion:Byte; Extended Attribute Record Version
EscapeSequenceSize:Byte; Length of Escape Sequences (LEN_ESC)
Reserved1:array[0..63] of Byte; Reserved for future standardization (00) bytes
ApplicationDataSize:Word; Length of Application Use (LEN_AU)
ApplicationDataSizeM:Word;  
ApplicationData:array[0..0] of Byte; Application Use LEN_AU bytes
EscapeSequence:array[0..0] of Byte; Escape Sequences LEN_ESC bytes

CDFS volume descriptor header

PCDFSVolumeDescriptorHeader = ^TCDFSVolumeDescriptorHeader;

TCDFSVolumeDescriptorHeader = packed record

Note: 2048 Bytes
DescriptorType:Byte; Descriptor Type 00 = Boot, 01 = Primary etc
StandardIdentifier:array[0..4] of Char; Standard Identifier ('CD001')
DescriptorVersion:Byte; Descriptor Version (1)
Reserved:array[0..2040] of Byte; Content depends on Descriptor Type

CDFS volume descriptor boot

PCDFSVolumeDescriptorBoot = ^TCDFSVolumeDescriptorBoot;

TCDFSVolumeDescriptorBoot = packed record

Note: 2048 Bytes
DescriptorType:Byte; Descriptor Type (00 = Boot)
StandardIdentifier:array[0..4] of Char; Standard Identifier ('CD001')
DescriptorVersion:Byte; Descriptor Version (1)
SystemIdentifier:array[0..31] of Char; 32 a-characters (eg EL TORITO SPECIFICATION)
BootIdentifier:array[0..31] of Char; 32 a-characters
BootData:array[0..1976] of Byte;  

CDFS volume descriptor primary

PCDFSVolumeDescriptorPrimary = ^TCDFSVolumeDescriptorPrimary;

TCDFSVolumeDescriptorPrimary = packed record

Note: 2048 Bytes
DescriptorType:Byte; Descriptor Type (01 = Primary)
StandardIdentifier:array[0..4] of Char; Standard Identifier ('CD001')
DescriptorVersion:Byte; Descriptor Version (1)
Reserved1:Byte; Unused Field (00) byte
SystemIdentifier:array[0..31] of Char; System Identifier a-characters
VolumeIdentifier:array[0..31] of Char; Volume Identifier d-characters
Reserved2:array[0..7] of Byte; Unused Field (00) bytes
VolumeSpaceSize:LongWord; Volume Space Size
VolumeSpaceSizeM:LongWord;  
Reserved3:array[0..31] of Byte; Unused Field (00) bytes
VolumeSetSize:Word; Volume Set Size
VolumeSetSizeM:Word;  
VolumeSequenceNumber:Word; Volume Sequence Number
VolumeSequenceNumberM:Word;  
LogicalBlockSize:Word; Logical Block Size
LogicalBlockSizeM:Word;  
PathTableSize:LongWord; Path Table Size
PathTableSizeM:LongWord;  
PrimaryPathTable:LongWord; Location of Occurrence of Type L Path Table
AlternatePathTable:LongWord; Location of Optional Occurrence of Type L Path Table
PrimaryPathTableM:LongWord; Location of Occurrence of Type M Path Table
AlternatePathTableM:LongWord; Location of Optional Occurrence of Type M Path Table
RootDirectory:TCDFSDirectoryRecord; Directory Record for Root Directory 34 bytes
VolumeSetIdentifier:array[0..127] of Char; Volume Set Identifier d-characters
PublisherIdentifier:array[0..127] of Char; Publisher Identifier a-characters
PreparerIdentifier:array[0..127] of Char; Data Preparer Identifier a-characters
ApplicationIdentifier:array[0..127] of Char; Application Identifier a-characters
CopyrightIdentifier:array[0..36] of Char; Copyright File Identifier d-characters, SEPARATOR 1, SEPARATOR 2
AbstractIdentifier:array[0..36] of Char; Abstract File Identifier d-characters, SEPARATOR 1, SEPARATOR 2
BibliographicIdentifier:array[0..36] of Char; Bibliographic File Identifier d-characters, SEPARATOR 1, SEPARATOR 2
CreateTime:TCDFSDateTime; Volume Creation Date and Time
ModifyTime:TCDFSDateTime; Volume Modification Date and Time
ExpireTime:TCDFSDateTime; Volume Expiration Date and Time
EffectiveTime:TCDFSDateTime; Volume Effective Date and Time
FileStructureVersion:Byte; File Structure Version
Reserved4:Byte; Reserved for future standardization (00) byte
ApplicationData:array[0..511] of Byte; Application Use not specified
Reserved5:array[0..652] of Byte; Reserved for future standardization (00) bytes

CDFS volume descriptor supplementary

PCDFSVolumeDescriptorSupplementary = ^TCDFSVolumeDescriptorSupplementary;

TCDFSVolumeDescriptorSupplementary = packed record

Note: 2048 Bytes
DescriptorType:Byte; Descriptor Type (02 = Supplementary)
StandardIdentifier:array[0..4] of Char; Standard Identifier ('CD001')
DescriptorVersion:Byte; Descriptor Version (1)
VolumeFlags:Byte; Volume Flags 8 bits
SystemIdentifier:array[0..31] of Char; System Identifier a-characters
VolumeIdentifier:array[0..31] of Char; Volume Identifier d-characters
Reserved2:array[0..7] of Byte; Unused Field (00) bytes
VolumeSpaceSize:LongWord; Volume Space Size
VolumeSpaceSizeM:LongWord;  
EscapeSequences:array[0..31] of Byte; Escape Sequences 32 bytes
VolumeSetSize:Word; Volume Set Size
VolumeSetSizeM:Word;  
VolumeSequenceNumber:Word; Volume Sequence Number
VolumeSequenceNumberM:Word;  
LogicalBlockSize:Word; Logical Block Size
LogicalBlockSizeM:Word;  
PathTableSize:LongWord; Path Table Size
PathTableSizeM:LongWord;  
PrimaryPathTable:LongWord; Location of Occurrence of Type L Path Table
AlternatePathTable:LongWord; Location of Optional Occurrence of Type L Path Table
PrimaryPathTableM:LongWord; Location of Occurrence of Type M Path Table
AlternatePathTableM:LongWord; Location of Optional Occurrence of Type M Path Table
RootDirectory:TCDFSDirectoryRecord; Directory Record for Root Directory 34 bytes
VolumeSetIdentifier:array[0..127] of Char; Volume Set Identifier d-characters
PublisherIdentifier:array[0..127] of Char; Publisher Identifier a-characters
PreparerIdentifier:array[0..127] of Char; Data Preparer Identifier a-characters
ApplicationIdentifier:array[0..127] of Char; Application Identifier a-characters
CopyrightIdentifier:array[0..36] of Char; Copyright File Identifier d-characters, SEPARATOR 1, SEPARATOR 2
AbstractIdentifier:array[0..36] of Char; Abstract File Identifier d-characters, SEPARATOR 1, SEPARATOR 2
BibliographicIdentifier:array[0..36] of Char; Bibliographic File Identifier d-characters, SEPARATOR 1, SEPARATOR 2
CreateTime:TCDFSDateTime; Volume Creation Date and Time
ModifyTime:TCDFSDateTime; Volume Modification Date and Time
ExpireTime:TCDFSDateTime; Volume Expiration Date and Time
EffectiveTime:TCDFSDateTime; Volume Effective Date and Time
FileStructureVersion:Byte; File Structure Version
Reserved4:Byte; Reserved for future standardization (00) byte
ApplicationData:array[0..511] of Byte; Application Use not specified
Reserved5:array[0..652] of Byte; Reserved for future standardization (00) bytes

CDFS volume descriptor partition

PCDFSVolumeDescriptorPartition = ^TCDFSVolumeDescriptorPartition;

TCDFSVolumeDescriptorPartition = packed record

Note: 2048 Bytes
DescriptorType:Byte; Descriptor Type (03 = Partition)
StandardIdentifier:array[0..4] of Char; Standard Identifier ('CD001')
DescriptorVersion:Byte; Descriptor Version (1)
Reserved1:Byte; Unused Field (00) byte
SystemIdentifier:array[0..31] of Char; System Identifier a-characters
PartitionIdentifier:array[0..31] of Char; Volume Partition Identifier d-characters
PartitionStart:LongWord; Volume Partition Location (first Logical Block)
PartitionStartM:LongWord;  
PartitionSize:LongWord; Volume Partition Size (in Logical Blocks)
PartitionSizeM:LongWord;  
SystemData:array[0..1959] of Byte; System Use not specified

CDFS volume descriptor terminator

PCDFSVolumeDescriptorTerminator = ^TCDFSVolumeDescriptorTerminator;

TCDFSVolumeDescriptorTerminator = packed record

Note: 2048 Bytes
DescriptorType:Byte; Descriptor Type (FF = Terminator)
StandardIdentifier:array[0..4] of Char; Standard Identifier ('CD001')
DescriptorVersion:Byte; Descriptor Version (1)
Reserved:array[0..2040] of Byte; Reserved (Always 00)

EL TORITO validation record

PELTORITOValidationRecord = ^TELTORITOValidationRecord;

TELTORITOValidationRecord = packed record

Note: 32 Bytes
HeaderId:Byte; Header ID, must be 01
PlatformId:Byte; Platform ID 0 = 80x86, 1 = PowerPC, 2 = Mac
Reserved1:Word; Reserved, must be 0
VendorId:array[0..23] of Char; ID string. This is intended to identify the manufacturer/developer of the CD-ROM
Checksum:Word; Checksum Word. This sum of all the words in this record should be 0
Signature:Word; Key byte, must be 55. Key byte, must be AA. This value is included in the checksum

EL TORITO default record

PELTORITODefaultRecord = ^TELTORITODefaultRecord;

TELTORITODefaultRecord = packed record

Note: 32 Bytes
BootIndicator:Byte; Boot Indicator. 88 = Bootable, 00 = Not Bootable
BootMedia:Byte; Boot media type. This specifies what media the boot image is intended to emulate
LoadSegment:Word; This is the load segment for the initial boot image. If this value is 0 the system will use the traditional segment of 7C0
SystemType:Byte; This must be a copy of byte 5 (System Type) from the Partition Table found in the boot image (PartitionId)
Reserved1:Byte; Unused, must be 0
LoadCount:Word; Sector Count. This is the number of virtual/emulated sectors the system will store at Load Segment during the initial boot procedure
LoadRBA:LongWord; Load RBA. This is the start address of the virtual disk. CDs use Relative/Logical block addressing
Reserved2:array[0..19] of Byte; {Unused, must be 0}  

EL TORITO section header

PELTORITOSectionHeader = ^TELTORITOSectionHeader;

TELTORITOSectionHeader = packed record

Note: 32 Bytes
HeaderIndicator:Byte; Header Indicator, 90 - Header, more headers follow, 91 - Final Header
PlatformId:Byte; Platform ID 0 = 80x86, 1 = PowerPC, 2 = Mac
SectionCount:Word; Number of section entries following this header
SectionId:array[0..27] of Char; ID string. This identifies a section

EL TORITO section record

PELTORITOSectionRecord = ^TELTORITOSectionRecord;

TELTORITOSectionRecord = packed record

Note: 32 Bytes
BootIndicator:Byte; Boot Indicator. 88 = Bootable, 00 = Not Bootable
BootMedia:Byte; Boot media type. This specifies what media the boot image emulates
LoadSegment:Word; Load Segment. This is the load segment for the initial boot image. If this value is 0 the system will use the traditional segment of 7C0
SystemType:Byte; System Type. This must be a copy of byte 5 (System Type) from the Partition Table found in the boot image (PartitionId)
Reserved1:Byte; Unused, must be 0
LoadCount:Word; Sector Count. This is the number of virtual/emulated sectors the system will store at Load Segment during the initial boot procedure
LoadRBA:LongWord; Load RBA. This is the start address of the virtual disk. CDs use Relative/Logical block addressing
SelectionType:Byte; Selection criteria type. 0 - No selection criteria, 1- Language and Version Information (IBM), 2-FF - Reserved
SelectionData:array[0..18] of Byte; Vendor unique selection criteria

EL TORITO section extension

PELTORITOSectionExtension = ^TELTORITOSectionExtension;

TELTORITOSectionExtension = packed record

Note: 32 Bytes
ExtensionIndicator:Byte; Extension Indicator. Must be 44
ExtensionFlag:Byte; Bits 1-4 - Unused, Bit 5 (1 = Extension Record follows, 0 = This is final Extension), Bits 6-7 - Unused
SelectionData:array[0..29] of Byte; Vendor unique selection criteria

EL TORITO volume descriptor boot

PELTORITOVolumeDescriptorBoot = ^TELTORITOVolumeDescriptorBoot;

TELTORITOVolumeDescriptorBoot = packed record

Note: 2048 Bytes
DescriptorType:Byte; Boot Record Indicator, must be 0
StandardIdentifier:array[0..4] of Char; ISO-9660 Identifier, must be 'CD001'
DescriptorVersion:Byte; Version of this descriptor, must be 1
SystemIdentifier:array[0..31] of Char; Boot System Identifier, must be 'EL TORITO SPECIFICATION' padded with 0s
Reserved1:array[0..31] of Byte; Unused, must be 0
CatalogStart:LongWord; Absolute pointer to first sector of Boot Catalog
Reserved2:array[0..1972] of Byte; Unused, must be 0


Class definitions



CDFS recognizer

TCDFSRecognizer = class(TRecognizer)

constructor Create(ADriver:TFileSysDriver);  
private
FLongNames:Boolean;  
FSwapSerial:Boolean;  
 
function CheckPrimaryDescriptor(ASector:PSector; const AStartSector:Int64; ASectorCount:LongWord):Boolean;  
protected
function GetName:String; override;  
public
property LongNames:Boolean read FLongNames write FLongNames;  
property SwapSerial:Boolean read FSwapSerial write FSwapSerial;  
 
function RecognizePartitionId(APartitionId:Byte):Boolean; override;  
function RecognizeBootSector(ABootSector:PBootSector; const AStartSector,ASectorCount:Int64):Boolean; override;  
 
function RecognizePartition(APartition:TDiskPartition):Boolean; override;  
function RecognizeVolume(AVolume:TDiskVolume):Boolean; override;  
function MountVolume(AVolume:TDiskVolume; ADrive:TDiskDrive):Boolean; override;  

CDFS formatter

TCDFSFormatter = class(TDiskFormatter)

private
function CheckDevice(AVolume:TDiskVolume; ADrive:TDiskDrive; AFloppyType:TFloppyType):Boolean;  
function CheckPartition(AVolume:TDiskVolume; ADrive:TDiskDrive; AFileSysType:TFileSysType):Boolean;  
 
function GetPathTableSize(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ASupplementary:Boolean):LongWord;  
function GetPathTableStart(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ASupplementary,AEndian:Boolean):LongWord;  
 
function GetRootDirectorySize(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ASupplementary:Boolean):LongWord;  
function GetRootDirectoryStart(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ASupplementary:Boolean):LongWord;  
 
function CreatePrimaryDescriptor(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ADescriptor:PCDFSVolumeDescriptorPrimary):Boolean;  
function WritePrimaryDescriptor(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ADescriptor:PCDFSVolumeDescriptorPrimary):Boolean;  
function WritePrimaryPathTables(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ADescriptor:PCDFSVolumeDescriptorPrimary):Boolean;  
function WritePrimaryRootDirectory(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ADescriptor:PCDFSVolumeDescriptorPrimary):Boolean;  
 
function CreateSupplementaryDescriptor(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ADescriptor:PCDFSVolumeDescriptorSupplementary):Boolean;  
function WriteSupplementaryDescriptor(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ADescriptor:PCDFSVolumeDescriptorSupplementary):Boolean;  
function WriteSupplementaryPathTables(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ADescriptor:PCDFSVolumeDescriptorSupplementary):Boolean;  
function WriteSupplementaryRootDirectory(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ADescriptor:PCDFSVolumeDescriptorSupplementary):Boolean;  
 
function CreateTerminatorDescriptor(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ADescriptor:PCDFSVolumeDescriptorTerminator):Boolean;  
function WriteTerminatorDescriptor(AVolume:TDiskVolume; ADrive:TDiskDrive; ACDFSType:TCDFSType; ADescriptor:PCDFSVolumeDescriptorTerminator):Boolean;  
public
function AcceptVolume(AVolume:TDiskVolume; AFloppyType:TFloppyType; AFileSysType:TFileSysType):Boolean; override;  
function FormatVolume(AVolume:TDiskVolume; AFloppyType:TFloppyType; AFileSysType:TFileSysType):Boolean; override;  

CDFS resizer

TCDFSResizer = class(TDiskResizer)

public
function AcceptVolume(AVolume:TDiskVolume; const AStart,ASize:Int64):Boolean; override;  
 
function ShrinkVolume(AVolume:TDiskVolume; const AStart,ASize:Int64):Boolean; override;  
function ExpandVolume(AVolume:TDiskVolume; const AStart,ASize:Int64):Boolean; override;  

CDFS copier

TCDFSCopier = class(TDiskCopier)

public
function AcceptVolume(AVolume,ADest:TDiskVolume):Boolean; override;  
 
function CopyVolume(AVolume,ADest:TDiskVolume):Boolean; override;  

CDFS file system

TCDFSFileSystem = class(TFileSystem)

constructor Create(ADriver:TFileSysDriver; AVolume:TDiskVolume; ADrive:TDiskDrive);  
destructor Destroy; override;  
private
FCDFSType:TCDFSType;  
FSwapSerial:Boolean;  
FVolumeFlags:LongWord; Volume flags
 
FTreesLoaded:Boolean;  
FBlocksLoaded:Boolean;  
FCatalogsLoaded:Boolean;  
FCatalogsLoading:Boolean;  
 
FBlockWrite:Boolean;  
FTreesPrepared:Boolean;  
FCatalogsChecked:Boolean;  
 
FLogicalBlockSize:Word; Size of a logical block on disk
FLogicalBlockCount:LongWord; Number of logical blocks on disk
 
FSectorsPerCluster:LongWord; Usually 1,2,4,8,16,32,64,128 etc
 
FDataStartCluster:LongWord; Usually 16 (First cluster of Data Area)
FBootStartCluster:LongWord; Usually 17 (Cluster of the Boot Descriptor)
FRootStartCluster:LongWord; Pointed to by Primary Descriptor
 
FBlockShiftCount:Word; Shift count for Cluster <-> BlockNo
FSectorShiftCount:Word; Shift count for Sector <-> Cluster
FClusterShiftCount:Word; Shift count for Cluster <-> Bytes
 
FEntriesPerBlock:LongWord; Number of Cluster entries per Block of bitmap
FClustersPerBlock:LongWord; Number of Clusters per Block of bitmap entries
FTotalBlockCount:LongWord; Total number of Blocks in bitmap
 
FTotalClusterCount:LongWord; Total number of Clusters on volume
 
FLastFreeCluster:LongWord; Or cdfsUnknownCluster if not known
FFreeClusterCount:LongWord; Or cdfsUnknownCluster if not known
 
FClusterSize:LongWord; Size of a Cluster in Bytes (Max 65536 > Word)
 
FBoot:TCDFSDiskDescriptor;  
FPrimary:TCDFSDiskDescriptor;  
FSupplementary:TCDFSDiskDescriptor;  
 
FHeaders:TFileSysList; List of Catalog Headers
FExtensions:TFileSysList; List of Catalog Extensions
FDescriptors:TFileSysList; List of Volume Descriptors
 
FHeaderLocal:TMutexHandle; Local Lock shared by all Catalog Headers
FExtensionLocal:TMutexHandle; Local Lock shared by all Catalog Extensions
FDescriptorLocal:TMutexHandle; Local Lock shared by all Volume Descriptors
 
FExtendedLocal:TMutexHandle; Local Lock shared by all Extended Attributes
 
FPathLock:TSynchronizerHandle; Lock shared by all Path lists
 
FReadBuffer:Pointer; Buffer for partial cluster entry reads (Cluster size)
FReadLock:TMutexHandle; Lock for read buffer
 
FWriteBuffer:Pointer; Buffer for partial cluster entry writes (Cluster size)
FWriteLock:TMutexHandle; Lock for write buffer
 
FClusterBuffer:Pointer; Buffer of exactly cluster size
FClusterLock:TMutexHandle; Lock for cluster buffer
 
function ReadLock:Boolean;  
function ReadUnlock:Boolean;  
 
function WriteLock:Boolean;  
function WriteUnlock:Boolean;  
 
function ClusterLock:Boolean;  
function ClusterUnlock:Boolean;  
 
function LoadTree(AEntry:TDiskEntry):Boolean;  
function MarkTree(AEntry:TDiskEntry):Boolean;  
function PrepareTree(AEntry:TDiskEntry):Boolean;  
function PrepareTable(ATable:TDiskTable):Boolean;  
 
function PrepareTrees:Boolean;  
function CheckCatalogs:Boolean;  
 
function LocatePath(ATable:TCDFSDiskTable; APathNumber:Word):TCDFSDiskPath;  
function LocateEntry(AEntry:TCDFSDiskEntry; AStartCluster:LongWord):TCDFSDiskEntry;  
 
function LoadVolumeFlags:LongWord;  
 
function FillClusters(ACluster:LongWord; ACount:Word; AValue:Byte):Boolean;  
 
function ReadClusters(ACluster:LongWord; ACount:Word; var ABuffer):Boolean;  
function WriteClusters(ACluster:LongWord; ACount:Word; const ABuffer):Boolean;  
 
function TestClusters(ACluster,ACount:LongWord):Boolean;  
function MarkClusters(ACluster,ACount:LongWord; AUsed:Boolean):Boolean;  
 
function AllocClusters(var ACluster:LongWord; ACount:LongWord):Boolean;  
function ReleaseClusters(ACluster,ACount:LongWord):Boolean;  
 
function GetNextFreeCluster:LongWord; Return is a Cluster
function GetFreeClusterCount:LongWord;  
 
function TestBlock(ABlock:TCDFSDiskBlock; AStart,ACount:LongWord):Boolean;  
function MarkBlock(ABlock:TCDFSDiskBlock; AStart,ACount:LongWord; AUsed:Boolean):Boolean;  
 
function AllocBlock(ABlock:TCDFSDiskBlock; AStart,ACount:LongWord):Boolean;  
function ReleaseBlock(ABlock:TCDFSDiskBlock; AStart,ACount:LongWord):Boolean;  
 
function GetBlockNextFree(ABlock:TCDFSDiskBlock; AStart:LongWord):LongWord;  
function GetBlockFreeCount(ABlock:TCDFSDiskBlock):LongWord;  
 
function TestBitmap(ABuffer:Pointer; ASize,AStart,ACount:LongWord):Boolean;  
function MarkBitmap(ABuffer:Pointer; ASize,AStart,ACount:LongWord; AUsed:Boolean):Boolean;  
 
function AllocBitmap(ABuffer:Pointer; ASize:LongWord; AStart,ACount:LongWord):Boolean;  
function ReleaseBitmap(ABuffer:Pointer; ASize:LongWord; AStart,ACount:LongWord):Boolean;  
 
function GetBitmapNextFree(ABuffer:Pointer; ASize,AStart:LongWord):LongWord;  
function GetBitmapFreeCount(ABuffer:Pointer; ASize:LongWord):LongWord;  
 
function GetTableDataFree(ATable:TDiskTable):LongWord;  
function GetEntryDataFree(AEntry:TDiskEntry):LongWord;  
function GetCatalogDataFree(ADescriptor:TCDFSDiskDescriptor):LongWord;  
 
function GetPreviousPath(ATable:TCDFSDiskTable; APath:TCDFSDiskPath):TCDFSDiskPath;  
function GetPreviousEntry(AParent,AEntry:TCDFSDiskEntry):TCDFSDiskEntry;  
 
function GetSectorsPerCluster(AClusterSize:LongWord):LongWord;  
function GetBlockShiftCount(AClusterSize:LongWord):Word;  
function GetSectorShiftCount(AClusterSize:LongWord):Word;  
function GetClusterShiftCount(AClusterSize:LongWord):Word;  
 
function GetEntriesPerBlock(AClusterSize:LongWord):LongWord;  
function GetClustersPerBlock(AClusterSize:LongWord):LongWord;  
function GetTotalBlockCount(ATotalClusterCount:LongWord):LongWord;  
 
function RenumberPaths(ATable:TDiskTable):Boolean;  
 
function ComparePath(APath1,APath2:TCDFSDiskPath; AUnicode:Boolean):Integer;  
function CompareEntry(AEntry1,AEntry2:TCDFSDiskEntry; AUnicode:Boolean):Integer;  
 
function PadString(const AString:String; ALength:Integer; APrefix,AUnicode:Boolean):String;  
function CompareString(const AString1,AString2:String; AReverse:Boolean):Integer;  
 
function ChecksumValidationRecord(AValidation:PELTORITOValidationRecord):Word;  
 
function RecordToPath(ARecord:Pointer; APath:TCDFSDiskPath; AUnicode,AEndian:Boolean):Boolean;  
function PathToRecord(APath:TCDFSDiskPath; ARecord:Pointer; AUnicode,AEndian:Boolean):Boolean;  
 
function RecordToEntry(ARecord:Pointer; AEntry:TCDFSDiskEntry; AUnicode:Boolean):Boolean;  
function EntryToRecord(AEntry:TCDFSDiskEntry; ARecord:Pointer; AUnicode:Boolean):Boolean;  
 
function CDFSTypeToFileSysType(ACDFSType:TCDFSType):TFileSysType;  
protected
function LoadMaxFile:Integer; override;  
function LoadMaxPath:Integer; override;  
function LoadAttributes:LongWord; override;  
function LoadSystemName:String; override;  
function LoadVolumeName:String; override;  
function LoadVolumeSerial:LongWord; override;  
function LoadFileSysType:TFileSysType; override;  
 
function SetVolumeName(const AName:String):Boolean;  
function SetVolumeSerial(ASerial:LongWord):Boolean;  
 
function ReadEntry(AParent,AEntry:TDiskEntry; var ABuffer; const AStart:Int64; ACount:LongWord; var AOffset,AValue:LongWord):Integer; override;  
function WriteEntry(AParent,AEntry:TDiskEntry; const ABuffer; const AStart:Int64; ACount:LongWord; var AOffset,AValue:LongWord):Integer; override;  
 
function LoadTrees:Boolean; Not override
function LoadTables:Boolean; override;  
function LoadBlocks:Boolean; override;  
function LoadDescriptors:Boolean; Not override
function LoadRoots:Boolean; Not override
function LoadPaths(ATable:TCDFSDiskTable):Boolean; Not override
function LoadEntries(AParent:TDiskEntry):Boolean; override;  
function LoadCatalogs:Boolean; override;  
 
function SetPaths(ATable:TCDFSDiskTable):Boolean; Not override
function SetEntries(AParent:TDiskEntry):Boolean; Not override
function SetCatalogs:Boolean; Not override
 
function LoadTable(ATableNo:LongWord):Boolean; override;  
function LoadBlock(ABlockNo:LongWord):Boolean; override;  
function LoadDescriptor(ABuffer:Pointer; ACluster:LongWord):Boolean; Not override
function LoadRoot(ADescriptor:TCDFSDiskDescriptor):Boolean; Not override
function LoadPath(ATable:TCDFSDiskTable; ABuffer:Pointer; AOffset:LongWord; ANumber:Word):Boolean; Not override
function LoadEntry(AParent:TCDFSDiskEntry; ABuffer:Pointer; AOffset,ACluster:LongWord):Boolean; Not override
function LoadHeader(ABuffer:Pointer; AOffset,ACluster:LongWord; AHeaderNo:LongWord):Boolean; Not override
function LoadCatalog(ABuffer:Pointer; AOffset,ACluster:LongWord; ACatalogNo:LongWord; AInitial:Boolean):Boolean; Not override
function LoadExtension(ABuffer:Pointer; AOffset,ACluster:LongWord; AExtensionNo:LongWord):Boolean; Not override
function LoadExtended(AEntry:TDiskEntry):Boolean; Not override
 
function AddDescriptor(AType:Byte):TCDFSDiskDescriptor; Not override
function RemoveDescriptor(ADescriptor:TCDFSDiskDescriptor):Boolean; Not override
 
function AddPath(ATable:TDiskTable; AParentNumber:Word; const AName:String; AStartCluster:LongWord):TCDFSDiskPath; Not override
function RemovePath(ATable:TDiskTable; APath:TCDFSDiskPath):Boolean; Not override
function RenamePath(ATable:TDiskTable; APath:TCDFSDiskPath; const AName:String):Boolean; Not override
function MovePath(ATable:TDiskTable; ADestNumber:Word; APath:TCDFSDiskPath):Boolean; Not override
 
function AddEntry(AParent:TDiskEntry; const AName:String; AAttributes:LongWord; AReference:Boolean):TDiskEntry; override;  
function AddEntryEx(AParent:TDiskEntry; const AName,AAltName:String; AAttributes:LongWord; AReference:Boolean):TDiskEntry; override;  
function RemoveEntry(AParent,AEntry:TDiskEntry):Boolean; override;  
function RenameEntry(AParent,AEntry:TDiskEntry; const AName:String):Boolean; override;  
function RenameEntryEx(AParent,AEntry:TDiskEntry; const AAltName:String):Boolean; override;  
function MoveEntry(ASource,ADest,AEntry:TDiskEntry):Boolean; override;  
 
function AddCatalog(AEntry:TDiskEntry; AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64):TDiskCatalog; override;  
function RemoveCatalog(ACatalog:TDiskCatalog):Boolean; override;  
function GetNextHeaderNo:LongWord; Not override
function GetMaxHeaderNo:LongWord; Not override
function GetNextHeaderOffset:LongWord; Not override
function GetNextHeaderCluster:LongWord; Not override
function GetNextCatalogOffset:LongWord; Not override
function GetNextCatalogCluster:LongWord; Not override
 
function SetTable(ATable:TDiskTable):Boolean; override;  
function SetBlock(ABlock:TDiskBlock):Boolean; override;  
function SetDescriptor(ADescriptor:TCDFSDiskDescriptor):Boolean; Not override
function SetRoot(ADescriptor:TCDFSDiskDescriptor; ARoot:TDiskEntry):Boolean; Not override
function SetPath(ATable:TDiskTable; APath:TCDFSDiskPath; ABuffer:Pointer):Boolean; Not override
function SetEntry(AParent,AEntry:TDiskEntry):Boolean; override;  
function SetHeader(AHeader:TCDFSDiskHeader):Boolean; Not override
function SetCatalog(ACatalog:TDiskCatalog):Boolean; override;  
function SetExtension(AExtension:TCDFSDiskExtension):Boolean; Not override
function SetExtended(AEntry:TDiskEntry; AExtended:TCDFSDiskExtended):Boolean; Not override
 
function SizeEntry(AParent,AEntry:TDiskEntry; const ASize:Int64):Boolean; override;  
 
function GetBlock(ABlockNo:LongWord):TDiskBlock; override;  
function GetBlockEx(ABlockNo:LongWord; AWrite:Boolean):TDiskBlock; override;  
function GetDescriptor(AType,AInstance:Byte):TCDFSDiskDescriptor; Not override
function GetDescriptorEx(AType,AInstance:Byte; AWrite:Boolean):TCDFSDiskDescriptor; Not override
function GetRoot(ADescriptor:TCDFSDiskDescriptor):TDiskEntry; Not override
function GetPath(ATable:TDiskTable; AParentNumber:Word; const AName:String):TCDFSDiskPath; Not override
function GetHeader(AHeaderNo:LongWord):TCDFSDiskHeader; Not override
function GetHeaderEx(AHeaderNo:LongWord; AWrite:Boolean):TCDFSDiskHeader; Not override
function GetExtension(AExtensionNo:LongWord):TCDFSDiskExtension; Not override
function GetExtensionEx(AExtensionNo:LongWord; AWrite:Boolean):TCDFSDiskExtension; Not override
function GetExtended(AEntry:TDiskEntry):TCDFSDiskExtended; Not override
 
function GetVersion(const AName:String):String;  
 
function StripDot(const AName:String):String;  
function StripVersion(const AName:String):String;  
 
function CompareName(const AName,AMatch:String; AWildcard:Boolean):Boolean; override;  
function CompareSequence(const ASequence; const ACompare; ASize:Integer):Boolean;  
function CompareIdentifier(const AIdentifier; const ACompare; ASize:Integer):Boolean;  
 
function CalculateVolumeSerial(ABuffer:Pointer; ASize:Integer):LongWord;  
public
property ReadOnly:Boolean read FReadOnly write FReadOnly;  
property LongNames:Boolean read FLongNames write FLongNames;  
property CasePreserved:Boolean read FCasePreserved write FCasePreserved;  
property UnicodeNames:Boolean read FUnicodeNames write FUnicodeNames;  
property SwapSerial:Boolean read FSwapSerial write FSwapSerial;  
 
function FileSystemInit:Boolean; override;  
 
function MountFileSystem:Boolean; override;  
function DismountFileSystem:Boolean; override;  
function InitializeFileSystem(ASectorsPerCluster:LongWord; AFileSysType:TFileSysType):Boolean; override;  
 
function GetDriveLabel:String; override;  
function SetDriveLabel(const ALabel:String):Boolean; override;  
function SetDriveSerial(ASerial:LongWord):Boolean; override;  
 
function GetDriveFreeSpaceEx:Int64; override;  
function GetDriveTotalSpaceEx:Int64; override;  

CDFS disk table

TCDFSDiskTable = class(TDiskTable)

Note: Represents a CDFS path table.
 
constructor Create(ALock:TSynchronizerHandle; ALocalLock:TMutexHandle; ADescriptor:TCDFSDiskDescriptor);  
destructor Destroy; override;  
private
FTableType:Byte;  
FEndian:Boolean;  
FUnicode:Boolean;  
 
FPathsLoaded:Boolean;  
 
FStartCluster:LongWord;  
FClusterCount:LongWord;  
 
FDataFree:LongWord; Data Free
FDataSize:LongWord; Data Length
 
FPaths:TFileSysListEx;  
FPathLocal:TMutexHandle;  
 
FDescriptor:TCDFSDiskDescriptor;  
public
property TableType:Byte read FTableType write FTableType;  
property Endian:Boolean read FEndian write FEndian;  
property Unicode:Boolean read FUnicode write FUnicode;  
 
property PathsLoaded:Boolean read FPathsLoaded write FPathsLoaded;  
 
property StartCluster:LongWord read FStartCluster write FStartCluster;  
property ClusterCount:LongWord read FClusterCount write FClusterCount;  
 
property DataFree:LongWord read FDataFree write FDataFree;  
property DataSize:LongWord read FDataSize write FDataSize;  
 
property Paths:TFileSysListEx read FPaths;  
property PathLocal:TMutexHandle read FPathLocal;  
property Descriptor:TCDFSDiskDescriptor read FDescriptor;  

CDFS disk block

TCDFSDiskBlock = class(TDiskBlock)

Note: Represents a block of clusters.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FBlockCount:LongWord; Number of cluster entries in this block
FBlockBuffer:Pointer;  
FBlockCluster:LongWord; First cluster represented by this block
public
property BlockCount:LongWord read FBlockCount write FBlockCount;  
property BlockBuffer:Pointer read FBlockBuffer write FBlockBuffer;  
property BlockCluster:LongWord read FBlockCluster write FBlockCluster;  

CDFS disk entry

TCDFSDiskEntry = class(TDiskEntry)

Note: Represents a CDFS directory entry.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FUnicode:Boolean;  
FVersion:String;  
 
FEntryOffset:LongWord;  
FEntryCluster:LongWord;  
FStartCluster:LongWord;  
FClusterCount:LongWord;  
 
FRecordSize:Byte; Length of Directory Record (LEN-DR)
FExtendedSize:Byte; Extended Attribute Record Length
FDataSize:LongWord; Data Length
FUnitSize:Byte; File Unit Size
FInterleaveSize:Byte; Interleave Gap Size
FSequenceNumber:Word; Volume Sequence Number
 
FDataFree:LongWord; Data Free
 
FPath:TCDFSDiskPath;  
FPathM:TCDFSDiskPath;  
FAltPath:TCDFSDiskPath;  
FAltPathM:TCDFSDiskPath;  
FExtended:TCDFSDiskExtended;  
 
function GetVersion:String;  
procedure SetVersion(const AVersion:String);  
public
property Unicode:Boolean read FUnicode write FUnicode;  
property Version:String read GetVersion write SetVersion;  
 
property EntryOffset:LongWord read FEntryOffset write FEntryOffset;  
property EntryCluster:LongWord read FEntryCluster write FEntryCluster;  
property StartCluster:LongWord read FStartCluster write FStartCluster;  
property ClusterCount:LongWord read FClusterCount write FClusterCount;  
 
property RecordSize:Byte read FRecordSize write FRecordSize;  
property ExtendedSize:Byte read FExtendedSize write FExtendedSize;  
property DataSize:LongWord read FDataSize write FDataSize;  
property FirstBlock:LongWord read FStartCluster write FStartCluster;  
property UnitSize:Byte read FUnitSize write FUnitSize;  
property InterleaveSize:Byte read FInterleaveSize write FInterleaveSize;  
property SequenceNumber:Word read FSequenceNumber write FSequenceNumber;  
 
property DataFree:LongWord read FDataFree write FDataFree;  
 
property Path:TCDFSDiskPath read FPath write FPath;  
property PathM:TCDFSDiskPath read FPathM write FPathM;  
property AltPath:TCDFSDiskPath read FAltPath write FAltPath;  
property AltPathM:TCDFSDiskPath read FAltPathM write FAltPathM;  
property Extended:TCDFSDiskExtended read FExtended write FExtended;  
 
function PathNumber:Word;  
function ParentNumber:Word;  
 
function FileIdentifier:String;  
function FileIdentifierSize:Byte;  
function DirectoryRecordSize:Byte;  
function ExtendedRecordSize:Byte;  

CDFS disk catalog

TCDFSDiskCatalog = class(TDiskCatalog)

Note: Represents a CDFS boot catalog entry (Also the Initial/Default entry).
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FCatalogOffset:LongWord;  
FCatalogCluster:LongWord;  
FStartCluster:LongWord;  
FClusterCount:LongWord;  
 
FInitial:Boolean;  
FBootIndicator:Byte;  
FBootMedia:Byte;  
FLoadSegment:Word;  
FSystemType:Byte;  
FLoadCount:Word;  
 
FSelectionType:Byte;  
FSelectionData:Pointer;  
 
FEntry:TCDFSDiskEntry;  
FHeader:TCDFSDiskHeader;  
protected
function GetName:String; override;  
procedure SetName(const AName:String); override;  
function GetMediaType:TMediaType; override;  
procedure SetMediaType(AMediaType:TMediaType); override;  
function GetFloppyType:TFloppyType; override;  
procedure SetFloppyType(AFloppyType:TFloppyType); override;  
function GetAttributes:LongWord; override;  
procedure SetAttributes(AAttributes:LongWord); override;  
function GetSectorSize:Word; override;  
procedure SetSectorSize(ASectorSize:Word); override;  
function GetSectorCount:Int64; override;  
procedure SetSectorCount(const ASectorCount:Int64); override;  
 
function GetStartCluster:LongWord;  
procedure SetStartCluster(AStartCluster:LongWord);  
function GetClusterCount:LongWord;  
procedure SetClusterCount(AClusterCount:LongWord);  
public
property CatalogOffset:LongWord read FCatalogOffset write FCatalogOffset;  
property CatalogCluster:LongWord read FCatalogCluster write FCatalogCluster;  
property StartCluster:LongWord read GetStartCluster write SetStartCluster;  
property ClusterCount:LongWord read GetClusterCount write SetClusterCount;  
 
property Initial:Boolean read FInitial write FInitial;  
property BootIndicator:Byte read FBootIndicator write FBootIndicator;  
property BootMedia:Byte read FBootMedia write FBootMedia;  
property LoadSegment:Word read FLoadSegment write FLoadSegment;  
property SystemType:Byte read FSystemType write FSystemType;  
property LoadCount:Word read FLoadCount write FLoadCount;  
 
property SelectionType:Byte read FSelectionType write FSelectionType;  
property SelectionData:Pointer read FSelectionData write FSelectionData;  
 
property Entry:TCDFSDiskEntry read FEntry write FEntry;  
property Header:TCDFSDiskHeader read FHeader write FHeader;  
property Validation:TCDFSDiskHeader read FHeader write FHeader;  

CDFS disk path

TCDFSDiskPath = class(TListObject)

Note: Represents a CDFS path table entry.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FLocalLock:TMutexHandle;  
 
FName:String;  
FHash:LongWord;  
 
FPathNumber:Word;  
FPathOffset:LongWord;  
FStartCluster:LongWord;  
 
FExtendedSize:Byte; Extended Attribute Record Length
FParentNumber:Word; Parent Directory Number
 
FParent:TCDFSDiskPath;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetName:String;  
procedure SetName(const AName:String);  
public
property Name:String read GetName write SetName;  
property Hash:LongWord read FHash;  
 
property PathNumber:Word read FPathNumber write FPathNumber;  
property PathOffset:LongWord read FPathOffset write FPathOffset;  
property StartCluster:LongWord read FStartCluster write FStartCluster;  
 
property ExtendedSize:Byte read FExtendedSize write FExtendedSize;  
property FirstBlock:LongWord read FStartCluster write FStartCluster;  
property ParentNumber:Word read FParentNumber write FParentNumber;  
 
property Parent:TCDFSDiskPath read FParent write FParent;  
 
function PathIdentifier:String;  
function PathIdentifierSize(AUnicode:Boolean):Byte;  
function PathRecordSize(AUnicode:Boolean):Byte;  

CDFS disk extended

TCDFSDiskExtended = class(TObject)

Note: Represents a CDFS extended attribute.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FLocalLock:TMutexHandle;  
 
FStartCluster:LongWord;  
FClusterCount:LongWord;  
 
FOwnerId:Word; Owner Identification
FGroupId:Word; Group Identification
FPermissions:Word; Permissions 16 bits
FCreateTime:TFileTime; File Creation Date and Time
FModifyTime:TFileTime; File Modification Date and Time
FExpireTime:TFileTime; File Expiration Date and Time
FEffectiveTime:TFileTime; File Effective Date and Time
FRecordFormat:Byte; Record Format
FRecordAttributes:Byte; Record Attributes
FRecordLength:Word; Record Length
FSystemIdentifier:String; System Identifier a-characters, a1-characters
FSystemData:Pointer; System Use not specified
FExtendedVersion:Byte; Extended Attribute Record Version
FEscapeSequenceSize:Byte; Length of Escape Sequences (LEN_ESC)
FApplicationDataSize:Word; Length of Application Use (LEN_AU)
FApplicationData:Pointer; Application Use LEN_AU bytes
FEscapeSequence:Pointer; Escape Sequences LEN_ESC bytes
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetSystemIdentifier:String;  
procedure SetSystemIdentifier(const ASystemIdentifier:String);  
public
property StartCluster:LongWord read FStartCluster write FStartCluster;  
property ClusterCount:LongWord read FClusterCount write FClusterCount;  
 
property OwnerId:Word read FOwnerId write FOwnerId;  
property GroupId:Word read FGroupId write FGroupId;  
property Permissions:Word read FPermissions write FPermissions;  
property CreateTime:TFileTime read FCreateTime write FCreateTime;  
property ModifyTime:TFileTime read FModifyTime write FModifyTime;  
property ExpireTime:TFileTime read FExpireTime write FExpireTime;  
property EffectiveTime:TFileTime read FEffectiveTime write FEffectiveTime;  
property RecordFormat:Byte read FRecordFormat write FRecordFormat;  
property RecordAttributes:Byte read FRecordAttributes write FRecordAttributes;  
property RecordLength:Word read FRecordLength write FRecordLength;  
property SystemIdentifier:String read GetSystemIdentifier write SetSystemIdentifier;  
property SystemData:Pointer read FSystemData write FSystemData;  
property ExtendedVersion:Byte read FExtendedVersion write FExtendedVersion;  
property EscapeSequenceSize:Byte read FEscapeSequenceSize write FEscapeSequenceSize;  
property ApplicationDataSize:Word read FApplicationDataSize write FApplicationDataSize;  
property ApplicationData:Pointer read FApplicationData write FApplicationData;  
property EscapeSequence:Pointer read FEscapeSequence write FEscapeSequence;  
 
function ExtendedRecordSize:Byte;  

CDFS disk descriptor

TCDFSDiskDescriptor = class(TListObject)

Note: Represents a CDFS volume descriptor.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FLocalLock:TMutexHandle;  
 
FUnicode:Boolean;  
 
FStartCluster:LongWord;  
 
FDescriptorType:Byte; Descriptor Type (00 = Boot, 01 = Primary etc)
FDescriptorVersion:Byte; Descriptor Version (1)
FStandardIdentifier:String; Standard Identifier ('CD001')
 
FSystemIdentifier:String; System Identifier a-characters (eg EL TORITO SPECIFICATION)
FVolumeIdentifier:String; Volume Identifier d-characters
FVolumeSpaceSize:LongWord; Volume Space Size
FVolumeSetSize:Word; Volume Set Size
FVolumeSequenceNumber:Word; Volume Sequence Number
FLogicalBlockSize:Word; Logical Block Size
FPathTableSize:LongWord; Path Table Size
FPrimaryPathTable:LongWord; Location of Occurrence of Type L Path Table
FAlternatePathTable:LongWord; Location of Optional Occurrence of Type L Path Table
FPrimaryPathTableM:LongWord; Location of Occurrence of Type M Path Table
FAlternatePathTableM:LongWord; Location of Optional Occurrence of Type M Path Table
FVolumeSetIdentifier:String; Volume Set Identifier d-characters
FPublisherIdentifier:String; Publisher Identifier a-characters
FPreparerIdentifier:String; Data Preparer Identifier a-characters
FApplicationIdentifier:String; Application Identifier a-characters
FCopyrightIdentifier:String; Copyright File Identifier d-characters, SEPARATOR 1, SEPARATOR 2
FAbstractIdentifier:String; Abstract File Identifier d-characters, SEPARATOR 1, SEPARATOR 2
FBibliographicIdentifier:String; Bibliographic File Identifier d-characters, SEPARATOR 1, SEPARATOR 2
FCreateTime:TFileTime; Volume Creation Date and Time
FModifyTime:TFileTime; Volume Modification Date and Time
FExpireTime:TFileTime; Volume Expiration Date and Time
FEffectiveTime:TFileTime; Volume Effective Date and Time
FFileStructureVersion:Byte; File Structure Version
FApplicationData:Pointer; Application Use not specified
 
FVolumeFlags:Byte; Volume Flags 8 bits
FEscapeSequences:Pointer; Escape Sequences 32 bytes
 
FBootIdentifier:String; 32 a-characters
FCatalogStart:LongWord; Absolute pointer to first sector of Boot Catalog
FCatalogCount:LongWord; Number of Sectors in Boot Catalog (Not Stored)
 
FPartitionIdentifier:String; Volume Partition Identifier d-characters
FPartitionStart:LongWord; Volume Partition Location (first Logical Block)
FPartitionSize:LongWord; Volume Partition Size (in Logical Blocks)
FSystemData:Pointer; System Use not specified
 
FRoot:TCDFSDiskEntry;  
FPrimary:TCDFSDiskTable;  
FPrimaryM:TCDFSDiskTable;  
FAlternate:TCDFSDiskTable;  
FAlternateM:TCDFSDiskTable;  
 
FInitial:TCDFSDiskCatalog;  
FValidation:TCDFSDiskHeader;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetStandardIdentifier:String;  
procedure SetStandardIdentifier(const AStandardIdentifier:String);  
 
function GetSystemIdentifier:String;  
procedure SetSystemIdentifier(const ASystemIdentifier:String);  
function GetVolumeIdentifier:String;  
procedure SetVolumeIdentifier(const AVolumeIdentifier:String);  
 
function GetVolumeSetIdentifier:String;  
procedure SetVolumeSetIdentifier(const AVolumeSetIdentifier:String);  
function GetPublisherIdentifier:String;  
procedure SetPublisherIdentifier(const APublisherIdentifier:String);  
function GetPreparerIdentifier:String;  
procedure SetPreparerIdentifier(const APreparerIdentifier:String);  
function GetApplicationIdentifier:String;  
procedure SetApplicationIdentifier(const AApplicationIdentifier:String);  
function GetCopyrightIdentifier:String;  
procedure SetCopyrightIdentifier(const ACopyrightIdentifier:String);  
function GetAbstractIdentifier:String;  
procedure SetAbstractIdentifier(const AAbstractIdentifier:String);  
function GetBibliographicIdentifier:String;  
procedure SetBibliographicIdentifier(const ABibliographicIdentifier:String);  
 
function GetBootIdentifier:String;  
procedure SetBootIdentifier(const ABootIdentifier:String);  
 
function GetPartitionIdentifier:String;  
procedure SetPartitionIdentifier(const APartitionIdentifier:String);  
public
property Unicode:Boolean read FUnicode write FUnicode;  
 
property StartCluster:LongWord read FStartCluster write FStartCluster;  
 
property DescriptorType:Byte read FDescriptorType write FDescriptorType;  
property DescriptorVersion:Byte read FDescriptorVersion write FDescriptorVersion;  
property StandardIdentifier:String read GetStandardIdentifier write SetStandardIdentifier;  
 
property SystemIdentifier:String read GetSystemIdentifier write SetSystemIdentifier;  
property VolumeIdentifier:String read GetVolumeIdentifier write SetVolumeIdentifier;  
property VolumeSpaceSize:LongWord read FVolumeSpaceSize write FVolumeSpaceSize;  
property VolumeSetSize:Word read FVolumeSetSize write FVolumeSetSize;  
property VolumeSequenceNumber:Word read FVolumeSequenceNumber write FVolumeSequenceNumber;  
property LogicalBlockSize:Word read FLogicalBlockSize write FLogicalBlockSize;  
property PathTableSize:LongWord read FPathTableSize write FPathTableSize;  
property PrimaryPathTable:LongWord read FPrimaryPathTable write FPrimaryPathTable;  
property AlternatePathTable:LongWord read FAlternatePathTable write FAlternatePathTable;  
property PrimaryPathTableM:LongWord read FPrimaryPathTableM write FPrimaryPathTableM;  
property AlternatePathTableM:LongWord read FAlternatePathTableM write FAlternatePathTableM;  
property VolumeSetIdentifier:String read GetVolumeSetIdentifier write SetVolumeSetIdentifier;  
property PublisherIdentifier:String read GetPublisherIdentifier write SetPublisherIdentifier;  
property PreparerIdentifier:String read GetPreparerIdentifier write SetPreparerIdentifier;  
property ApplicationIdentifier:String read GetApplicationIdentifier write SetApplicationIdentifier;  
property CopyrightIdentifier:String read GetCopyrightIdentifier write SetCopyrightIdentifier;  
property AbstractIdentifier:String read GetAbstractIdentifier write SetAbstractIdentifier;  
property BibliographicIdentifier:String read GetBibliographicIdentifier write SetBibliographicIdentifier;  
property CreateTime:TFileTime read FCreateTime write FCreateTime;  
property ModifyTime:TFileTime read FModifyTime write FModifyTime;  
property ExpireTime:TFileTime read FExpireTime write FExpireTime;  
property EffectiveTime:TFileTime read FEffectiveTime write FEffectiveTime;  
property FileStructureVersion:Byte read FFileStructureVersion write FFileStructureVersion;  
property ApplicationData:Pointer read FApplicationData write FApplicationData;  
 
property VolumeFlags:Byte read FVolumeFlags write FVolumeFlags;  
property EscapeSequences:Pointer read FEscapeSequences write FEscapeSequences;  
 
property BootIdentifier:String read GetBootIdentifier write SetBootIdentifier;  
property CatalogStart:LongWord read FCatalogStart write FCatalogStart;  
property CatalogCount:LongWord read FCatalogCount write FCatalogCount;  
 
property PartitionIdentifier:String read GetPartitionIdentifier write SetPartitionIdentifier;  
property PartitionStart:LongWord read FPartitionStart write FPartitionStart;  
property PartitionSize:LongWord read FPartitionSize write FPartitionSize;  
property SystemData:Pointer read FSystemData write FSystemData;  
 
property Root:TCDFSDiskEntry read FRoot write FRoot;  
property Primary:TCDFSDiskTable read FPrimary write FPrimary;  
property PrimaryM:TCDFSDiskTable read FPrimaryM write FPrimaryM;  
property Alternate:TCDFSDiskTable read FAlternate write FAlternate;  
property AlternateM:TCDFSDiskTable read FAlternateM write FAlternateM;  
 
property Initial:TCDFSDiskCatalog read FInitial write FInitial;  
property Validation:TCDFSDiskHeader read FValidation write FValidation;  

CDFS disk header

TCDFSDiskHeader = class(TListObject)

Note: Represents a CDFS catalog header (Also the Validation entry).
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FLocalLock:TMutexHandle;  
 
FHeaderNo:LongWord;  
 
FHeaderOffset:LongWord;  
FHeaderCluster:LongWord;  
 
FValidation:Boolean;  
FHeaderId:Byte;  
FPlatformId:Byte;  
FVendorId:String;  
FChecksum:Word;  
FSignature:Word;  
 
FSectionCount:Word;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetVendorId:String;  
procedure SetVendorId(const AVendorId:String);  
public
property HeaderNo:LongWord read FHeaderNo write FHeaderNo;  
 
property HeaderOffset:LongWord read FHeaderOffset write FHeaderOffset;  
property HeaderCluster:LongWord read FHeaderCluster write FHeaderCluster;  
 
property Validation:Boolean read FValidation write FValidation;  
property HeaderId:Byte read FHeaderId write FHeaderId;  
property PlatformId:Byte read FPlatformId write FPlatformId;  
property VendorId:String read GetVendorId write SetVendorId;  
property Checksum:Word read FChecksum write FChecksum;  
property Signature:Word read FSignature write FSignature;  
 
property HeaderIndicator:Byte read FHeaderId write FHeaderId;  
property SectionCount:Word read FSectionCount write FSectionCount;  
property SectionId:String read GetVendorId write SetVendorId;  

CDFS disk extension

TCDFSDiskExtension = class(TListObject)

Note: Represents a CDFS catalog extension.
 
constructor Create(ALocalLock:TMutexHandle);  
destructor Destroy; override;  
private
FLocalLock:TMutexHandle;  
 
FExtensionNo:LongWord;  
 
FExtensionOffset:LongWord;  
FExtensionCluster:LongWord;  
 
FExtensionIndicator:Byte;  
FExtensionFlag:Byte;  
FSelectionData:Pointer;  
 
FCatalog:TCDFSDiskCatalog;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
public
property ExtensionNo:LongWord read FExtensionNo write FExtensionNo;  
 
property ExtensionOffset:LongWord read FExtensionOffset write FExtensionOffset;  
property ExtensionCluster:LongWord read FExtensionCluster write FExtensionCluster;  
 
property ExtensionIndicator:Byte read FExtensionIndicator write FExtensionIndicator;  
property ExtensionFlag:Byte read FExtensionFlag write FExtensionFlag;  
property SelectionData:Pointer read FSelectionData write FSelectionData;  
 
property Catalog:TCDFSDiskCatalog read FCatalog write FCatalog;  


Public variables


None defined

Function declarations



Initialization functions

procedure CDFSInit;
Description: To be documented
Note None documented


procedure CDFSQuit;
Description: To be documented
Note None documented


CDFS helper functions

function CDFSDataToPointer(const AData; ASize:Integer; ASwap:Boolean):Pointer;
Description: Creates a pointer and copies data from a buffer
Note Allows byte order swapping on copy


function CDFSPointerToData(APointer:Pointer; var AData; ASize:Integer; ASwap:Boolean):Boolean;
Description: Copies data to a buffer from supplied pointer
Note Allows byte order swapping on copy


function CDFSIdentifierToString(const AIdentifier; ASize:Integer; AUnicode:Boolean):String;
Description: Converts the supplied indentifier to a string
Note Accounts for unicode and byte ordering


function CDFSStringToIdentifier(const AString:String; var AIdentifier; ASize:Integer; AUnicode:Boolean):Boolean;
Description: Converts the supplied string to an identifier
Note Accounts for unicode and byte ordering


function CDFSIdentifierToFileName(const AIdentifier; ASize:Integer; AUnicode:Boolean):String;
Description: Converts the supplied identifier to a filename
Note Accounts for dot and dot dot special entries


function CDFSFileNameToIdentifier(const AFileName:String; var AIdentifier; ASize:Integer; AUnicode:Boolean):Boolean;
Description: Converts the supplied filename to an identifier
Note Accounts for dot and dot dot special entries


function CDFSTimeToFileTime(const ATime:TCDFSTime):TFileTime;
Description: Converts a CDFS Time in Local to a File Time in UTC
Note None documented


function FileTimeToCDFSTime(const AFileTime:TFileTime; var ATime:TCDFSTime):Boolean;
Description: Converts a File Time in UTC to a CDFS Time in Local
Note None documented


function CDFSDateTimeToFileTime(const ADateTime:TCDFSDateTime):TFileTime;
Description: Converts a CDFS Date Time in Local to a File Time in UTC
Note None documented


function FileTimeToCDFSDateTime(const AFileTime:TFileTime; var ADateTime:TCDFSDateTime):Boolean;
Description: Converts a File Time in UTC to a CDFS Date Time in Local
Note None documented


Return to Unit Reference