Difference between revisions of "Unit VirtualDisk"
Line 612: | Line 612: | ||
|- | |- | ||
| <code>magicNumber:LongWord;</code> | | <code>magicNumber:LongWord;</code> | ||
− | | 0x44574f43 / 'COWD' | + | | 0x44574f43/'COWD' |
|- | |- | ||
| <code>version:LongWord;</code> | | <code>version:LongWord;</code> | ||
Line 710: | Line 710: | ||
|- | |- | ||
| <code>magicNumber:LongWord;</code> | | <code>magicNumber:LongWord;</code> | ||
− | | 0x564d444b / 'VMDK' | + | | 0x564d444b/'VMDK' |
|- | |- | ||
| <code>version:LongWord;</code> | | <code>version:LongWord;</code> | ||
Line 845: | Line 845: | ||
|- | |- | ||
| <code>CreatorApplication:array[0..3] of Char;</code> | | <code>CreatorApplication:array[0..3] of Char;</code> | ||
− | | Microsoft Virtual PC = "vpc " / Microsoft Virtual Server = "vs " | + | | Microsoft Virtual PC = "vpc "/Microsoft Virtual Server = "vs " |
|- | |- | ||
| <code>CreatorVersion:LongWord;</code> | | <code>CreatorVersion:LongWord;</code> | ||
− | | Virtual Server 2004 = 0x00010000 / Virtual PC 2004 = 0x00050000 | + | | Virtual Server 2004 = 0x00010000/Virtual PC 2004 = 0x00050000 |
|- | |- | ||
| <code>CreatorHostOS:LongWord;</code> | | <code>CreatorHostOS:LongWord;</code> | ||
− | | Windows 0x5769326B (Wi2k) / Macintosh 0x4D616320 (Mac ) | + | | Windows 0x5769326B (Wi2k)/Macintosh 0x4D616320 (Mac ) |
|- | |- | ||
| <code>OriginalSize:Int64;</code> | | <code>OriginalSize:Int64;</code> | ||
Line 922: | Line 922: | ||
|- | |- | ||
| <code>ParentUnicodeName:array[0..255] of WideChar;</code> | | <code>ParentUnicodeName:array[0..255] of WideChar;</code> | ||
− | | parent hard disk filename (Unicode /UTF16 string) | + | | parent hard disk filename (Unicode/UTF16 string) |
|- | |- | ||
| <code>ParentLocator1:TVpcParentLocator;</code> | | <code>ParentLocator1:TVpcParentLocator;</code> |
Revision as of 03:58, 13 April 2017
Return to Unit Reference
Contents
Description
Ultibo Virtual Disk interface unit
To be documented
Constants
VIRTUAL_*
VIRTUAL_DEVICE_DESCRIPTION = 'Virtual Disk Device';
|
|
VIRTUAL_CONTROLLER_DESCRIPTION = 'Virtual Disk Controller';
|
virtualFlag*
virtualFlagNone = $00000000;
|
|
virtualFlagFixed = $00000001;
|
|
virtualFlagDynamic = $00000002;
|
|
virtualFlagBase = $00000004;
|
|
virtualFlagDelta = $00000008;
|
|
virtualFlagDevice = $00000010;
|
|
virtualFlagSplit = $00000020;
|
vmware*
vmwareFileExtension = '.vmdk';
|
|
vmwareFileMask = '*.vmdk';
|
|
vmwareNoParentCID = $FFFFFFFF;
|
not($00000000) |
vmwareSparseMagicNumber = $564d444b;
|
'VMDK' |
vmwareEsxSparseMagicNumber = $44574f43;
|
'COWD' |
vmwareEsxSparseMaxParentLength = 1024;
|
COWDISK_MAX_PARENT_FILELEN |
vmwareEsxSparseMaxNameLength = 60;
|
COWDISK_MAX_NAME_LEN |
vmwareEsxSparseMaxDescriptionLength = 512;
|
COWDISK_MAX_DESC_LEN |
vmwareSectorSize = 512;
|
vmware*DiskType
vmwareMaxDiskType = 0;
|
|
vmwareDiskTypeNone = 0;
|
vmwareTag*
vmwareTagDisk = 'Disk DescriptorFile';
|
|
vmwareTagVersion = 'version';
|
|
vmwareTagCID = 'CID';
|
|
vmwareTagParentCID = 'parentCID';
|
|
vmwareTagCreateType = 'createType';
|
|
vmwareTagExtent = 'Extent Description';
|
|
vmwareTagDatabase = 'The Disk Data Base';
|
|
vmwareTagDDB = 'DDB';
|
|
vmwareTagAdapter = 'ddb.adapterType';
|
|
vmwareTagSectors = 'ddb.geometry.sectors';
|
|
vmwareTagHeads = 'ddb.geometry.heads';
|
|
vmwareTagCylinders = 'ddb.geometry.cylinders';
|
|
vmwareTagParentHint = 'parentFileNameHint';
|
vmwareCreateType_*
vmwareMaxCreateType = 11;
|
|
vmwareCreateType_monolithicSparse = 0;
|
|
vmwareCreateType_vmfsSparse = 1;
|
|
vmwareCreateType_monolithicFlat = 2;
|
|
vmwareCreateType_vmfs = 3;
|
|
vmwareCreateType_twoGbMaxExtentSparse = 4;
|
|
vmwareCreateType_twoGbMaxExtentFlat = 5;
|
|
vmwareCreateType_fullDevice = 6;
|
|
vmwareCreateType_vmfsRaw = 7;
|
|
vmwareCreateType_partitionedDevice = 8;
|
|
vmwareCreateType_vmfsRawDeviceMap = 9;
|
|
vmwareCreateType_vmfsPassthroughRawDeviceMap = 10;
|
|
vmwareCreateType_streamOptimized = 11;
|
vmwareAccessType_*
vmwareMaxAccessType = 2;
|
|
vmwareAccessType_RW = 0;
|
|
vmwareAccessType_RDONLY = 1;
|
|
vmwareAccessType_NOACCESS = 2;
|
vmwareExtentType_*
vmwareMaxExtentType = 6;
|
|
vmwareExtentType_FLAT = 0;
|
|
vmwareExtentType_SPARSE = 1;
|
|
vmwareExtentType_ZERO = 2;
|
|
vmwareExtentType_VMFS = 3;
|
|
vmwareExtentType_VMFSSPARSE = 4;
|
|
vmwareExtentType_VMFSRDM = 5;
|
|
vmwareExtentType_VMFSRAW = 6;
|
vmwareFlag*
vmwareFlagValidTest = $00000001;
|
bit 0: valid new line detection test |
vmwareFlagRedundantGrain = $00000002;
|
bit 1: redundant grain table will be used |
vmwareFlagGrainCompressed = $00010000;
|
bit 16: the grains are compressed. The type of compression is described by compressAlgorithm |
vmwareFlagLBAMarkers = $00020000;
|
bit 17: there are markers in the virtual disk to identify every block of metadata or data and the markers for the virtual machine data contain a LBA |
vmwareCompression*
vmwareCompressionNone = 0;
|
|
vmwareCompressionDeflate = 1;
|
The deflate algorithm is described in RFC 1951 |
vpc*
vpcFileExtension = '.vhd';
|
|
vpcUndoExtension = '.vud';
|
|
vpcFileMask = '*.vhd';
|
|
vpcUndoMask = '*.vud';
|
|
vpcSplitMask = '*.v??';
|
.v01, v02 etc up to 64 |
vpcFooterCookie = 'conectix';
|
|
vpcDynamicCookie = 'cxsparse';
|
|
vpcMaxDiskExtents = 64;
|
Maximum number of 4GB split files in a disk image |
vpcExtentMaxSize = 4294967296;
|
Maximum size of s split file (4GB) |
vpcUnixTimeOffset = 946684800;
|
Offset from 1/1/1970 to 1/1/2000 |
vpcFooterVersion = $00010000;
|
|
vpcDynamicVersion = $00010000;
|
|
vpcSectorSize = 512;
|
|
vpcUnallocatedBlock = $FFFFFFFF;
|
|
vpcFixedDiskTableOffset = $FFFFFFFFFFFFFFFF;
|
|
vpcDynamicDiskDataOffset = $FFFFFFFFFFFFFFFF;
|
|
vpcMaxBlockGroup = $FF;
|
|
vpcBlockGroupMask = $FF;
|
|
vpcBlockGroupOffset = $100;
|
vpcDiskType*
vpcMaxDiskType = 6;
|
|
vpcDiskTypeNone = 0;
|
|
vpcDiskTypeReserved1 = 1;
|
|
vpcDiskTypeFixed = 2;
|
|
vpcDiskTypeDynamic = 3;
|
|
vpcDiskTypeDifferencing = 4;
|
|
vpcDiskTypeReserved2 = 5;
|
|
vpcDiskTypeReserved3 = 6;
|
vpcFeature*
vpcFeatureNone = $00000000;
|
|
vpcFeatureTemporary = $00000001;
|
|
vpcFeatureReserved = $00000002;
|
This bit must always be set to 1 |
vpcCreator*
vpcCreatorWindows = $5769326B;
|
Wi2k |
vpcCreatorMacintosh = $4D616320;
|
Mac |
vpcPlatform*
vpcPlatformNone = $00000000;
|
|
vpcPlatformWi2r = $57693272;
|
Wi2r deprecated |
vpcPlatformWi2k = $5769326B;
|
Wi2k deprecated |
vpcPlatformW2ru = $57327275;
|
W2ru Unicode pathname (UTF-16) on Windows relative to the differencing disk pathname |
vpcPlatformW2ku = $57326B75;
|
W2ku Absolute Unicode (UTF-16) pathname on Windows |
vpcPlatformMac = $4D616320;
|
Mac OS alias stored as a blob |
vpcPlatformMacX = $4D616358;
|
MacX A file URL with UTF-8 encoding conforming to RFC 2396 |
vpcBitmapMask*
vpcBitmapMaskBits = 32;
|
LongWord Bitmap Masks |
vpcBitmapMaskNone = $00000000;
|
LongWord (Used for fast counting of free blocks) |
vpcBitmapMaskAll = $FFFFFFFF;
|
LongWord (Used for fast counting of used blocks) |
vpcBitmapMasks:array[0..31] of LongWord = (
| |
$00000001,$00000002,$00000004,$00000008,$00000010,$00000020,$00000040,$00000080,
| |
$00000100,$00000200,$00000400,$00000800,$00001000,$00002000,$00004000,$00008000,
| |
$00010000,$00020000,$00040000,$00080000,$00100000,$00200000,$00400000,$00800000,
| |
$01000000,$02000000,$04000000,$08000000,$10000000,$20000000,$40000000,$80000000);
| |
vpcBitmapMasks:array[0..31] of LongWord = (
|
Ordered to allow for big endian bitmap |
$00000080,$00000040,$00000020,$00000010,$00000008,$00000004,$00000002,$00000001,
| |
$00008000,$00004000,$00002000,$00001000,$00000800,$00000400,$00000200,$00000100,
| |
$00800000,$00400000,$00200000,$00100000,$00080000,$00040000,$00020000,$00010000,
| |
$80000000,$40000000,$20000000,$10000000,$08000000,$04000000,$02000000,$01000000);
|
vbox*
vboxFileExtension = '.vdi';
|
|
vboxDiskBanner = '<<< Sun xVM VirtualBox Disk Image >>>';
|
Plus a LF character in some images (#10) |
vboxDiskVersion = $00010001;
|
|
vboxDiskSignature = $BEDA107F;
|
|
vboxFileMask = '*.vdi';
|
|
vboxPathMask = '*.*';
|
|
vboxDeltaPath = '..\Machines\';
|
|
vboxParentPath = '..\..\..\VDI\';
|
|
vboxNewParentPath = '..\..\..\HardDisks\';
|
|
vboxSnapshotPath = '\Snapshots\';
|
|
vboxUnallocatedBlock = $FFFFFFFF;
|
vboxDiskType*
vboxMaxDiskType = 4;
|
|
vboxDiskTypeNone = 0;
|
|
vboxDiskTypeDynamic = 1;
|
|
vboxDiskTypeStatic = 2;
|
|
vboxDiskTypeUnknown = 3;
|
|
vboxDiskTypeDifferencing = 4;
|
vboxDiskFlags*
vboxDiskFlagsNone = $00000000;
|
Type definitions
ESX sparse extent header
PEsxSparseExtentHeader = ^TEsxSparseExtentHeader;
TEsxSparseExtentHeader = packed record
Note: Always 2048 bytes (Only used for Delta disks, not Dynamic) | |
magicNumber:LongWord;
|
0x44574f43/'COWD' |
version:LongWord;
|
The value of this entry should be 1 |
flags:LongWord;
|
set to 3 |
numSectors:LongWord;
|
total number of sectors on the base disk |
grainSize:LongWord;
|
one sector by default. Can vary from one sector to 1MB |
gdOffset:LongWord;
|
starts at the fourth sector, because the COWDisk_Header structure takes four sectors |
numGDEntries:LongWord;
|
is CEILING(numSectors, gtCoverage) |
freeSector:LongWord;
|
the next free data sector. This needs to be less than the length of the delta link. It is initially set to gdOffset + numGDSectors |
case Integer of
|
|
0: (cylinders:LongWord;
|
root |
heads:LongWord;
|
|
sectors:LongWord;
|
|
generation:LongWord;
|
cont |
name:array[0..vmwareEsxSparseMaxNameLength - 1] of Char;
|
|
description:array[0..vmwareEsxSparseMaxDescriptionLength - 1] of Char;
|
|
savedGeneration:LongWord;
|
used to detect the unclean shutdown of the delta link. It is initially set to 0 |
reserved:array[0..7] of Char;
|
|
uncleanShutdown:LongWord;
|
used to trigger the metadata consistency check in case there is an abnormal termination of the program |
padding:array[0..395] of Char);
|
|
1: (parentFileName:array[0..vmwareEsxSparseMaxParentLength - 1] of Char;
|
child |
parentGeneration:LongWord;
|
|
generationx:LongWord;
|
cont |
namex:array[0..vmwareEsxSparseMaxNameLength - 1] of Char;
|
|
descriptionx:array[0..vmwareEsxSparseMaxDescriptionLength - 1] of Char;
|
|
savedGenerationx:LongWord;
|
used to detect the unclean shutdown of the delta link. It is initially set to 0 |
reservedx:array[0..7] of Char;
|
|
uncleanShutdownx:LongWord;
|
used to trigger the metadata consistency check in case there is an abnormal termination of the program |
paddingx:array[0..395] of Char);
|
remaining fields are not used. They are present to maintain compatibility with legacy virtual disk formats |
VMware sparse extent header
PVmwareSparseExtentHeader = ^TVmwareSparseExtentHeader;
TVmwareSparseExtentHeader = packed record
Note: Always 512 bytes (Used for both Dynamic and Delta disks) | |
magicNumber:LongWord;
|
0x564d444b/'VMDK' |
version:LongWord;
|
The value of this entry should be 1 |
flags:LongWord;
|
See above |
capacity:Int64;
|
the capacity of this extent in sectors (should be a multiple of the grain size) |
grainSize:Int64;
|
size of a grain in sectors (must be a power of 2 and must be greater than 8 (4KB)) |
descriptorOffset:Int64;
|
offset of the embedded descriptor in the extent (expressed in sectors) |
descriptorSize:Int64;
|
valid only if descriptorOffset is non-zero (expressed in sectors) |
numGTEsPerGT:LongWord;
|
the number of entries in a grain table (for VMware virtual disks is 512) |
rgdOffset:Int64;
|
redundant level 0 of metadata (expressed in sectors) |
gdOffset:Int64;
|
level 0 of metadata (expressed in sectors) |
overHead:Int64;
|
number of sectors occupied by the metadata |
uncleanShutdown:ByteBool;
|
set to FALSE when VMware software closes an extent. Four entries are used to detect when an extent file has been corrupted by transferring it using FTP in text mode. The entries should be initialized with the following values |
singleEndLineChar:Char;
|
'\n' |
nonEndLineChar:Char;
|
' ' |
doubleEndLineChar1:Char;
|
'\r' |
doubleEndLineChar2:Char;
|
'\n' |
compressAlgorithm:Word;
|
See above |
pad:array[0..432] of Byte;
|
VPC dish geometry
PVpcDiskGeometry = ^TVpcDiskGeometry;
TVpcDiskGeometry = packed record
Note: Always 4 bytes | |
Cylinders:Word;
|
Cylinders |
Heads:Byte;
|
Heads |
Sectors:Byte;
|
Sectors per track |
VPC parent locator
PVpcParentLocator = ^TVpcParentLocator;
TVpcParentLocator = packed record
Note: Always 24 bytes | |
PlatformCode:LongWord;
|
describes which platform-specific format is used for the file locator (see above) |
PlatformDataSpace:LongWord;
|
the number of 512-byte sectors needed to store the parent hard disk locator |
PlatformDataLength:LongWord;
|
length of the parent hard disk locator in bytes |
Reserved:LongWord;
|
Reserved, must be zero |
PlatformDataOffset:Int64;
|
offset in bytes where the platform specific file locator data is stored |
VPC hard disk footer
PVpcHardDiskFooter = ^TVpcHardDiskFooter;
TVpcHardDiskFooter = packed record
Note: Always 512 bytes (At end of file on Fixed disks, at start and end on Dynamic and Differencing disks) | |
Cookie:array[0..7] of Char;
|
conectix |
Features:LongWord;
|
|
Version:LongWord;
|
0x00010000 |
DataOffset:Int64;
|
Offset to Dynamic Disk Header, Must be 0xFFFFFFFF for Fixed Disks |
TimeStamp:LongWord;
|
seconds since January 1, 2000 12:00:00 AM in UTC/GMT (Unix Time minus 30 years) |
CreatorApplication:array[0..3] of Char;
|
Microsoft Virtual PC = "vpc "/Microsoft Virtual Server = "vs " |
CreatorVersion:LongWord;
|
Virtual Server 2004 = 0x00010000/Virtual PC 2004 = 0x00050000 |
CreatorHostOS:LongWord;
|
Windows 0x5769326B (Wi2k)/Macintosh 0x4D616320 (Mac ) |
OriginalSize:Int64;
|
Size in Bytes of the VHD at Creation |
CurrentSize:Int64;
|
Current Size in Bytes of the VHD |
DiskGeometry:TVpcDiskGeometry;
|
See above |
DiskType:LongWord;
|
See above |
Checksum:LongWord;
|
1s compliment checksum of the footer |
UniqueId:TGUID;
|
|
SavedState:ByteBool;
|
Set to 1 if disk is in a saved state |
Reserved:array[0..426] of Byte;
|
Reserved, must be zero |
VPC dynamic disk header
PVpcDynamicDiskHeader = ^TVpcDynamicDiskHeader;
TVpcDynamicDiskHeader = packed record
Note: Always 1024 bytes (Used for both Dynamic and Differencing disks) | |
Cookie:array[0..7] of Char;
|
cxsparse |
DataOffset:Int64;
|
currently unused by existing formats and should be set to 0xFFFFFFFF |
TableOffset:Int64;
|
absolute byte offset of the Block Allocation Table (BAT) |
HeaderVersion:LongWord;
|
must be initialized to 0x00010000 |
MaxTableEntries:LongWord;
|
maximum entries present in the BAT. equal to the number of blocks in the disk (disk size divided by the blocksize) |
BlockSize:LongWord;
|
The default value is 0x00200000 (indicating a block size of 2 MB) |
Checksum:LongWord;
|
1s compliment checksum of the header |
ParentUniqueId:TGUID;
|
only used for differencing hard disks |
ParentTimeStamp:LongWord;
|
number of seconds since January 1, 2000 12:00:00 AM in UTC/GMT |
Reserved1:LongWord;
|
Must be zero |
ParentUnicodeName:array[0..255] of WideChar;
|
parent hard disk filename (Unicode/UTF16 string) |
ParentLocator1:TVpcParentLocator;
|
These entries store an absolute byte offset in the file where the parent locator for a differencing hard disk is stored |
ParentLocator2:TVpcParentLocator;
|
These fields are used only for differencing disks and should be set to zero for dynamic disks |
ParentLocator3:TVpcParentLocator;
|
These fields are used only for differencing disks and should be set to zero for dynamic disks |
ParentLocator4:TVpcParentLocator;
|
These fields are used only for differencing disks and should be set to zero for dynamic disks |
ParentLocator5:TVpcParentLocator;
|
These fields are used only for differencing disks and should be set to zero for dynamic disks |
ParentLocator6:TVpcParentLocator;
|
These fields are used only for differencing disks and should be set to zero for dynamic disks |
ParentLocator7:TVpcParentLocator;
|
These fields are used only for differencing disks and should be set to zero for dynamic disks |
ParentLocator8:TVpcParentLocator;
|
These fields are used only for differencing disks and should be set to zero for dynamic disks |
Reserved2:array[0..255] of Byte;
|
Reserved, must be zero |
VirtualBox disk header
PVboxDiskHeader = ^TVboxDiskHeader;
TVboxDiskHeader = packed record
Note: Always 512 bytes (At start of file for both Fixed and Dynamic disks) | |
Banner:array[0..63] of Char;
|
<<< Sun xVM VirtualBox Disk Image >>> |
Signature:LongWord;
|
7F 10 DA BE |
Version:LongWord;
|
1.1 |
HeaderSize:LongWord;
|
0x190 |
DiskType:LongWord;
|
see above |
DiskFlags:LongWord;
|
see above |
Description:array[0..255] of Char;
|
Unused |
BlocksOffset:LongWord;
|
|
DataOffset:LongWord;
|
|
Cylinders:LongWord;
|
|
Heads:LongWord;
|
|
Sectors:LongWord;
|
|
SectorSize:LongWord;
|
|
Reserved1:LongWord;
|
Must be zero |
DiskSize:Int64;
|
Bytes |
BlockSize:LongWord;
|
|
BlockExtra:LongWord;
|
|
TotalBlocks:LongWord;
|
|
AllocatedBlocks:LongWord;
|
|
UUID:TGUID;
|
|
SnapshotUUID:TGUID;
|
|
LinkUUID:TGUID;
|
|
ParentUUID:TGUID;
|
|
Unknown1:LongWord;
|
|
Unknown2:LongWord;
|
|
Reserved2:LongWord;
|
Must be 0x3F |
Reserved3:LongWord;
|
Must be 0x200 |
Unused:array[0..9] of LongWord;
|
Class definitions
Virtual disk controller
TVirtualDiskController = class(TDiskController)
constructor Create(ADriver:TFileSysDriver);
|
|
private
| |
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 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 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;
|
Virtual disk device
TVirtualDiskDevice = class(TDiskDevice)
private
| |
public
| |
function DeviceInit:Boolean; override;
|
|
function LocatePartitions:Boolean; override;
|
|
function LocateVolumes:Boolean; override;
|
|
function CreatePartition(AParent:TDiskPartition; APartitionId:Byte; ACount:LongWord; AActive:Boolean):Boolean; override;
|
|
function DeletePartition(APartition:TDiskPartition):Boolean; override;
|
|
function ModifyPartition(APartition:TDiskPartition; APartitionId:Byte):Boolean; override;
|
|
function ActivatePartition(APartition:TDiskPartition; AActive:Boolean):Boolean; override;
|
|
function ShrinkPartition(APartition:TDiskPartition; const AStart,ASize:Int64):Boolean; override;
|
|
function ExpandPartition(APartition:TDiskPartition; const AStart,ASize:Int64):Boolean; override;
|
Virtual disk partition
TVirtualDiskPartition = class(TDiskPartition)
private
| |
public
| |
function PartitionInit:Boolean; override;
|
|
function LocatePartitions:Boolean; override;
|
|
function LocateVolumes:Boolean; override;
|
Virtual disk image
TVirtualDiskImage = class(TDiskImage)
constructor Create(ADriver:TFileSysDriver; AController:TDiskController; const AName:String; AImageNo:Integer);
|
|
destructor Destroy; override;
|
|
private
| |
protected
| |
FFlags:LongWord;
|
|
FExtents:TFileSysList;
|
List of Virtual Disk Extents |
FBase:TVirtualDiskExtent;
|
The first extent of the image |
FCurrent:TVirtualDiskExtent;
|
The current delta extent if applicable |
function GetCylinders:LongWord; override;
|
|
function GetHeads:LongWord; override;
|
|
function GetSectors:LongWord; override;
|
|
function ReadExtent(AExtent:TVirtualDiskExtent; ASector:LongWord; ACount:Word; var ABuffer):Word; virtual;
|
|
function WriteExtent(AExtent:TVirtualDiskExtent; ASector:LongWord; ACount:Word; const ABuffer):Word; virtual;
|
|
function LoadExtents:Boolean; virtual;
|
|
function CloseExtents:Boolean; virtual;
|
|
function CheckExtent(ADelta,AParent:TVirtualDiskExtent; const AFilename:String):Boolean; virtual;
|
|
function LoadExtent(ADelta,AParent:TVirtualDiskExtent; const AFilename:String):TVirtualDiskExtent; virtual;
|
|
function AddExtent(AParent:TVirtualDiskExtent; const AFilename:String):TVirtualDiskExtent; virtual;
|
|
function RemoveExtent(AExtent:TVirtualDiskExtent):Boolean; virtual;
|
|
function SetExtent(AExtent:TVirtualDiskExtent):Boolean; virtual;
|
|
function GetExtent(const ASector:Int64; AWrite,ALock:Boolean):TVirtualDiskExtent; virtual;
|
|
function FindExtent(const AFilename:String; ALock:Boolean):TVirtualDiskExtent; virtual;
|
|
function LoadTables:Boolean; virtual;
|
|
function LoadTable(AExtent:TVirtualDiskExtent; ATableNo:LongWord):TVirtualDiskTable; virtual;
|
|
function AddTable(AExtent:TVirtualDiskExtent):TVirtualDiskTable; virtual;
|
|
function RemoveTable(ATable:TVirtualDiskTable):Boolean; virtual;
|
|
function SetTable(ATable:TVirtualDiskTable):Boolean; virtual;
|
|
function GetTable(AExtent:TVirtualDiskExtent; const ASector:Int64; AWrite:Boolean):TVirtualDiskTable; virtual;
|
|
function LoadBlocks(ATable:TVirtualDiskTable):Boolean; virtual;
|
|
function LoadBlock(ATable:TVirtualDiskTable; ABlockNo:LongWord):TVirtualDiskBlock; virtual;
|
|
function AddBlock(ATable:TVirtualDiskTable):TVirtualDiskBlock; virtual;
|
|
function RemoveBlock(ABlock:TVirtualDiskBlock):Boolean; virtual;
|
|
function SetBlock(ABlock:TVirtualDiskBlock):Boolean; virtual;
|
|
function GetBlock(ATable:TVirtualDiskTable; const ASector:Int64; AWrite:Boolean):TVirtualDiskBlock; virtual;
|
|
function LocateDelta(AExtent:TVirtualDiskExtent):String; virtual;
|
|
function LocateParent(AExtent:TVirtualDiskExtent):String; virtual;
|
|
function LocateSibling(AExtent:TVirtualDiskExtent):String; virtual;
|
|
public
| |
property Flags:LongWord read FFlags write FFlags;
|
|
property Extents:TFileSysList read FExtents;
|
|
property Base:TVirtualDiskExtent read FBase;
|
|
property Current:TVirtualDiskExtent read FCurrent;
|
|
function IsSplit:Boolean; virtual;
|
Virtual disk memory image
TVirtualDiskMemoryImage = class(TVirtualDiskImage)
constructor Create(ADriver:TFileSysDriver; AController:TDiskController; const AName:String; AImageNo:Integer);
|
|
destructor Destroy; override;
|
|
private
| |
FData:Pointer;
|
|
protected
| |
function GetReady:Boolean; override;
|
|
function GetSectorSize:Word; override;
|
|
function GetSectorCount:Int64; override;
|
|
function GetPartitionId:Byte; override;
|
|
procedure SetName(const AName:String); override;
|
|
public
| |
function Read(ASector:LongWord; ACount:Word; var ABuffer):Boolean; override;
|
|
function Write(ASector:LongWord; ACount:Word; const ABuffer):Boolean; override;
|
|
function ConvertImage(AImageType:TImageType):Boolean; override;
|
|
function CreateImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function CloseImage:Boolean; override;
|
Virtual disk file image
TVirtualDiskFileImage = class(TVirtualDiskImage)
constructor Create(ADriver:TFileSysDriver; AController:TDiskController; const AName:String; AImageNo:Integer);
|
|
destructor Destroy; override;
|
|
private
| |
FHandle:THandle;
|
|
protected
| |
function GetReady:Boolean; override;
|
|
function GetSectorSize:Word; override;
|
|
function GetSectorCount:Int64; override;
|
|
function GetPartitionId:Byte; override;
|
|
public
| |
function Read(ASector:LongWord; ACount:Word; var ABuffer):Boolean; override;
|
|
function Write(ASector:LongWord; ACount:Word; const ABuffer):Boolean; override;
|
|
function CreateImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function OpenImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function CloseImage:Boolean; override;
|
|
function ResizeImage(const ASectorCount:Int64):Boolean; override;
|
Virtual disk device image
TVirtualDiskDeviceImage = class(TVirtualDiskImage)
constructor Create(ADriver:TFileSysDriver; AController:TDiskController; const AName:String; AImageNo:Integer);
|
|
destructor Destroy; override;
|
|
private
| |
FHandle:THandle;
|
|
protected
| |
function GetReady:Boolean; override;
|
|
function GetCylinders:LongWord; override;
|
|
function GetHeads:LongWord; override;
|
|
function GetSectors:LongWord; override;
|
|
function GetSectorSize:Word; override;
|
|
function GetSectorCount:Int64; override;
|
|
function GetPartitionId:Byte; override;
|
|
public
| |
function Read(ASector:LongWord; ACount:Word; var ABuffer):Boolean; override;
|
|
function Write(ASector:LongWord; ACount:Word; const ABuffer):Boolean; override;
|
|
function ConvertImage(AImageType:TImageType):Boolean; override;
|
|
function ShrinkImage(const ASize:Int64):Boolean; override;
|
|
function ExpandImage(const ASize:Int64):Boolean; override;
|
|
function OpenImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function CloseImage:Boolean; override;
|
Virtual disk ISO image
TVirtualDiskIsoImage = class(TVirtualDiskImage)
constructor Create(ADriver:TFileSysDriver; AController:TDiskController; const AName:String; AImageNo:Integer);
|
|
destructor Destroy; override;
|
|
private
| |
FHandle:THandle;
|
|
protected
| |
function GetReady:Boolean; override;
|
|
function GetSectorSize:Word; override;
|
|
function GetSectorCount:Int64; override;
|
|
public
| |
function Read(ASector:LongWord; ACount:Word; var ABuffer):Boolean; override;
|
|
function Write(ASector:LongWord; ACount:Word; const ABuffer):Boolean; override;
|
|
function ConvertImage(AImageType:TImageType):Boolean; override;
|
|
function CreateImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function OpenImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function CloseImage:Boolean; override;
|
|
function ResizeImage(const ASectorCount:Int64):Boolean; override;
|
Virtual disk Bochs image
TVirtualDiskBochsImage = class(TVirtualDiskImage)
constructor Create(ADriver:TFileSysDriver; AController:TDiskController; const AName:String; AImageNo:Integer);
|
|
destructor Destroy; override;
|
|
private
| |
protected
| |
function GetReady:Boolean; override;
|
|
function GetCylinders:LongWord; override;
|
|
function GetHeads:LongWord; override;
|
|
function GetSectors:LongWord; override;
|
|
function GetSectorSize:Word; override;
|
|
function GetSectorCount:Int64; override;
|
|
public
| |
function Read(ASector:LongWord; ACount:Word; var ABuffer):Boolean; override;
|
|
function Write(ASector:LongWord; ACount:Word; const ABuffer):Boolean; override;
|
|
function Allocated(ASector:LongWord; ACount:Word):Word; override;
|
|
function CreateImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function OpenImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function CloseImage:Boolean; override;
|
|
function ResizeImage(const ASectorCount:Int64):Boolean; override;
|
Virtual disk VMware image
TVirtualDiskVmwareImage = class(TVirtualDiskImage)
constructor Create(ADriver:TFileSysDriver; AController:TDiskController; const AName:String; AImageNo:Integer);
|
|
destructor Destroy; override;
|
|
private
| |
function GetAttributes:LongWord;
|
|
protected
| |
FDescriptor:TVirtualDiskExtent;
|
|
function GetReady:Boolean; override;
|
|
function GetCylinders:LongWord; override;
|
|
function GetHeads:LongWord; override;
|
|
function GetSectors:LongWord; override;
|
|
function GetSectorSize:Word; override;
|
|
function GetSectorCount:Int64; override;
|
|
public
| |
property Descriptor:TVirtualDiskExtent read FDescriptor;
|
|
function ImageInit:Boolean; override;
|
|
function Read(ASector:LongWord; ACount:Word; var ABuffer):Boolean; override;
|
|
function Write(ASector:LongWord; ACount:Word; const ABuffer):Boolean; override;
|
|
function Allocated(ASector:LongWord; ACount:Word):Word; override;
|
|
function LoadDescriptor(const AFilename:String):Boolean;
|
|
function AddDescriptor(const AFilename:String):TVirtualDiskVmwareExtent;
|
|
function RemoveDescriptor(AExtent:TVirtualDiskVmwareExtent):Boolean;
|
|
function SetDescriptor(AExtent:TVirtualDiskVmwareExtent):Boolean;
|
|
function GetDescriptor:TVirtualDiskVmwareExtent;
|
|
function CreateImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function OpenImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function CloseImage:Boolean; override;
|
|
function ResizeImage(const ASectorCount:Int64):Boolean; override;
|
|
function CreateSnapshot:Boolean; override;
|
|
function DeleteSnapshot:Boolean; override;
|
|
function MergeSnapshot:Boolean; override;
|
Virtual disk VPC image
TVirtualDiskVpcImage = class(TVirtualDiskImage)
constructor Create(ADriver:TFileSysDriver; AController:TDiskController; const AName:String; AImageNo:Integer);
|
|
destructor Destroy; override;
|
|
private
| |
function GetAttributes:LongWord;
|
|
function ChecksumFooter(AFooter:PVpcHardDiskFooter):LongWord;
|
|
function ChecksumSparse(ASparse:PVpcDynamicDiskHeader):LongWord;
|
|
function RoundToSector(AValue:LongWord;ASectorSize:Word):LongWord;
|
|
protected
| |
function GetReady:Boolean; override;
|
|
function GetCylinders:LongWord; override;
|
|
function GetHeads:LongWord; override;
|
|
function GetSectors:LongWord; override;
|
|
function GetSectorSize:Word; override;
|
|
function GetSectorCount:Int64; override;
|
|
function ReadExtent(AExtent:TVirtualDiskExtent; ASector:LongWord; ACount:Word; var ABuffer):Word; override;
|
|
function WriteExtent(AExtent:TVirtualDiskExtent; ASector:LongWord; ACount:Word; const ABuffer):Word; override;
|
|
function LoadExtents:Boolean; override;
|
|
function CheckExtent(ADelta,AParent:TVirtualDiskExtent; const AFilename:String):Boolean; override;
|
|
function LoadExtent(ADelta,AParent:TVirtualDiskExtent; const AFilename:String):TVirtualDiskExtent; override;
|
|
function AddExtent(AParent:TVirtualDiskExtent; const AFilename:String):TVirtualDiskExtent; override;
|
|
function SetExtent(AExtent:TVirtualDiskExtent):Boolean; override;
|
|
function GetExtent(const ASector:Int64; AWrite,ALock:Boolean):TVirtualDiskExtent; override;
|
|
function LoadTables:Boolean; override;
|
|
function LoadTable(AExtent:TVirtualDiskExtent; ATableNo:LongWord):TVirtualDiskTable; override;
|
|
function AddTable(AExtent:TVirtualDiskExtent):TVirtualDiskTable; override;
|
|
function SetTable(ATable:TVirtualDiskTable):Boolean; override;
|
|
function LoadBlocks(ATable:TVirtualDiskTable):Boolean; override;
|
|
function LoadBlock(ATable:TVirtualDiskTable; ABlockNo:LongWord):TVirtualDiskBlock; override;
|
|
function AddBlock(ATable:TVirtualDiskTable):TVirtualDiskBlock; override;
|
|
function SetBlock(ABlock:TVirtualDiskBlock):Boolean; override;
|
|
function GetBlock(ATable:TVirtualDiskTable; const ASector:Int64; AWrite:Boolean):TVirtualDiskBlock; override;
|
|
function TestBlock(ABlock:TVirtualDiskBlock; const ASector:Int64; ACount:LongWord; AUsed:Boolean):LongWord;
|
|
function MarkBlock(ABlock:TVirtualDiskBlock; const ASector:Int64; ACount:LongWord; AUsed:Boolean):Boolean;
|
|
function TestBitmap(ABuffer:Pointer; ASize,AStart,ACount:LongWord; AUsed:Boolean):LongWord;
|
|
function MarkBitmap(ABuffer:Pointer; ASize,AStart,ACount:LongWord; AUsed:Boolean):Boolean;
|
|
function LocateDelta(AExtent:TVirtualDiskExtent):String; override;
|
|
function LocateParent(AExtent:TVirtualDiskExtent):String; override;
|
|
function LocateSibling(AExtent:TVirtualDiskExtent):String; override;
|
|
public
| |
function ImageInit:Boolean; override;
|
|
function Read(ASector:LongWord; ACount:Word; var ABuffer):Boolean; override;
|
|
function Write(ASector:LongWord; ACount:Word; const ABuffer):Boolean; override;
|
|
function Allocated(ASector:LongWord; ACount:Word):Word; override;
|
|
function CreateImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function OpenImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function CloseImage:Boolean; override;
|
|
function ResizeImage(const ASectorCount:Int64):Boolean; override;
|
|
function CreateSnapshot:Boolean; override;
|
|
function DeleteSnapshot:Boolean; override;
|
|
function MergeSnapshot:Boolean; override;
|
Virtual disk VirtualBox image
TVirtualDiskVboxImage = class(TVirtualDiskImage)
constructor Create(ADriver:TFileSysDriver; AController:TDiskController; const AName:String; AImageNo:Integer);
|
|
destructor Destroy; override;
|
|
private
| |
function GetAttributes:LongWord;
|
|
protected
| |
function GetReady:Boolean; override;
|
|
function GetCylinders:LongWord; override;
|
|
function GetHeads:LongWord; override;
|
|
function GetSectors:LongWord; override;
|
|
function GetSectorSize:Word; override;
|
|
function GetSectorCount:Int64; override;
|
|
function ReadExtent(AExtent:TVirtualDiskExtent; ASector:LongWord; ACount:Word; var ABuffer):Word; override;
|
|
function WriteExtent(AExtent:TVirtualDiskExtent; ASector:LongWord; ACount:Word; const ABuffer):Word; override;
|
|
function LoadExtents:Boolean; override;
|
|
function CheckExtent(ADelta,AParent:TVirtualDiskExtent; const AFilename:String):Boolean; override;
|
|
function LoadExtent(ADelta,AParent:TVirtualDiskExtent; const AFilename:String):TVirtualDiskExtent; override;
|
|
function AddExtent(AParent:TVirtualDiskExtent; const AFilename:String):TVirtualDiskExtent; override;
|
|
function SetExtent(AExtent:TVirtualDiskExtent):Boolean; override;
|
|
function GetExtent(const ASector:Int64; AWrite,ALock:Boolean):TVirtualDiskExtent; override;
|
|
function LoadTables:Boolean; override;
|
|
function LoadTable(AExtent:TVirtualDiskExtent; ATableNo:LongWord):TVirtualDiskTable; override;
|
|
function AddTable(AExtent:TVirtualDiskExtent):TVirtualDiskTable; override;
|
|
function SetTable(ATable:TVirtualDiskTable):Boolean; override;
|
|
function LocateDelta(AExtent:TVirtualDiskExtent):String; override;
|
|
function LocateParent(AExtent:TVirtualDiskExtent):String; override;
|
|
public
| |
function ImageInit:Boolean; override;
|
|
function Read(ASector:LongWord; ACount:Word; var ABuffer):Boolean; override;
|
|
function Write(ASector:LongWord; ACount:Word; const ABuffer):Boolean; override;
|
|
function Allocated(ASector:LongWord; ACount:Word):Word; override;
|
|
function CreateImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function OpenImage(AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64; ACylinders,AHeads,ASectors:LongWord; APartitionId:Byte):Integer; override;
|
|
function CloseImage:Boolean; override;
|
|
function ResizeImage(const ASectorCount:Int64):Boolean; override;
|
|
function CreateSnapshot:Boolean; override;
|
|
function DeleteSnapshot:Boolean; override;
|
|
function MergeSnapshot:Boolean; override;
|
Virtual recognizer
TVirtualRecognizer = class(TRecognizer)
constructor Create(ADriver:TFileSysDriver; AController:TDiskController);
|
|
destructor Destroy; override;
|
|
private
| |
protected
| |
FController:TDiskController;
|
|
function GetName:String; override;
|
|
public
| |
function RecognizeImage(AImage:TDiskImage):Boolean; override;
|
|
function MountImage(AImage:TDiskImage):Boolean; override;
|
|
function InsertImage(AImage:TDiskImage):Boolean; override;
|
Virtual disk resizer
TVirtualDiskResizer = class(TDiskResizer)
constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);
|
|
destructor Destroy; override;
|
|
private
| |
public
| |
function AcceptImage(AImage:TDiskImage; const ASize:Int64):Boolean; override;
|
|
function ShrinkImage(AImage:TDiskImage; const ASize:Int64):Boolean; override;
|
|
function ExpandImage(AImage:TDiskImage; const ASize:Int64):Boolean; override;
|
Virtual disk copier
TVirtualDiskCopier = class(TDiskCopier)
constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer);
|
|
destructor Destroy; override;
|
|
private
| |
public
| |
function AcceptImage(AImage,ADest:TDiskImage):Boolean; override;
|
|
function CopyImage(AImage,ADest:TDiskImage):Boolean; override;
|
Virtual disk imager
TVirtualDiskImager = class(TDiskImager)
constructor Create(ADriver:TFileSysDriver; ARecognizer:TRecognizer; AController:TDiskController);
|
|
destructor Destroy; override;
|
|
private
| |
function CreateImageByType(const AName:String; AImageType:TImageType):TDiskImage;
|
|
protected
| |
FController:TDiskController;
|
|
public
| |
function AcceptImage(AImage:TDiskImage; const AName:String; AImageType:TImageType; AMediaType:TMediaType; AFloppyType:TFloppyType; AAttributes:LongWord; ASectorSize:Word; const ASectorCount:Int64):Boolean; override;
|
|
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; override;
|
|
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; override;
|
|
function CloseImage(AImage:TDiskImage):Boolean; override;
|
|
function AcceptSnapshot(AImage:TDiskImage):Boolean; override;
|
|
function CreateSnapshot(AImage:TDiskImage):Boolean; override;
|
|
function DeleteSnapshot(AImage:TDiskImage):Boolean; override;
|
|
function MergeSnapshot(AImage:TDiskImage):Boolean; override;
|
Virtual disk extent
TVirtualDiskExtent = class(TListObject)
Note: Represents an Extent (usually a file) forming part of a virtual disk | |
constructor Create(AImage:TVirtualDiskImage; ADelta,AParent:TVirtualDiskExtent);
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TMutexHandle;
|
|
protected
| |
FImage:TVirtualDiskImage;
|
|
FDelta:TVirtualDiskExtent;
|
|
FParent:TVirtualDiskExtent;
|
|
FFlags:LongWord;
|
|
FFilename:String;
|
Filename of the file backing this Extent |
FHandle:THandle;
|
DiskDriver Handle to the file of this Extent |
FDataOffset:Int64;
|
Absolute byte offset of Data in file (Where Applicable) |
FBlockSize:LongWord;
|
Size of each data block in file |
FStartSector:Int64;
|
First Sector contained by this Extent |
FSectorCount:Int64;
|
Number of Sectors contained by this Extent |
FBlockShiftCount:LongWord;
|
Sector to Block Shift Count |
function GetFilename:String;
|
|
procedure SetFilename(const AFilename:String);
|
|
function GetBlockShiftCount:LongWord; virtual;
|
|
public
| |
property Image:TVirtualDiskImage read FImage;
|
|
property Delta:TVirtualDiskExtent read FDelta write FDelta;
|
|
property Parent:TVirtualDiskExtent read FParent write FParent;
|
|
property Flags:LongWord read FFlags write FFlags;
|
|
property Filename:String read GetFilename write SetFilename;
|
|
property Handle:THandle read FHandle write FHandle;
|
|
property DataOffset:Int64 read FDataOffset write FDataOffset;
|
|
property BlockSize:LongWord read FBlockSize write FBlockSize;
|
|
property StartSector:Int64 read FStartSector write FStartSector;
|
|
property SectorCount:Int64 read FSectorCount write FSectorCount;
|
|
property BlockShiftCount:LongWord read FBlockShiftCount write FBlockShiftCount;
|
|
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
|
function IsFixed:Boolean; virtual;
|
|
function IsDynamic:Boolean; virtual;
|
|
function IsBase:Boolean; virtual;
|
|
function IsDelta:Boolean; virtual;
|
|
function IsDevice:Boolean; virtual;
|
|
function HasDelta:Boolean; virtual;
|
Virtual disk VMware extent
TVirtualDiskVmwareExtent = class(TVirtualDiskExtent)
private
| |
protected
| |
public
| |
function IsDescriptor:Boolean;
|
|
function HasDescriptor:Boolean;
|
Virtual disk VPC extent
TVirtualDiskVpcExtent = class(TVirtualDiskExtent)
constructor Create(AImage:TVirtualDiskImage; ADelta,AParent:TVirtualDiskExtent);
|
|
destructor Destroy; override;
|
|
private
| |
FHeader:PVpcHardDiskFooter;
|
|
FFooter:PVpcHardDiskFooter;
|
|
FSparse:PVpcDynamicDiskHeader;
|
|
FHeaderOffset:Int64;
|
Absolute byte offset of Header in file |
FHeaderSize:LongWord;
|
Size of Header in image |
FFooterOffset:Int64;
|
Absolute byte offset of Footer in file |
FFooterSize:LongWord;
|
Size of Footer in image |
FSparseOffset:Int64;
|
Absolute byte offset of Dynamic Header in file |
FSparseSize:LongWord;
|
Size of Dynamic Header in image |
protected
| |
FTable:TVirtualDiskVpcTable;
|
VirtualPC images contain only one Table per Extent |
FGroups:TFileSysList;
|
Block bitmap Groups |
FGroupLocal:TMutexHandle;
|
Local Lock shared by all Block bitmap Groups |
public
| |
property Header:PVpcHardDiskFooter read FHeader;
|
|
property Footer:PVpcHardDiskFooter read FFooter;
|
|
property Sparse:PVpcDynamicDiskHeader read FSparse;
|
|
property Table:TVirtualDiskVpcTable read FTable;
|
|
property Groups:TFileSysList read FGroups;
|
|
property HeaderOffset:Int64 read FHeaderOffset write FHeaderOffset;
|
|
property HeaderSize:LongWord read FHeaderSize write FHeaderSize;
|
|
property FooterOffset:Int64 read FFooterOffset write FFooterOffset;
|
|
property FooterSize:LongWord read FFooterSize write FFooterSize;
|
|
property SparseOffset:Int64 read FSparseOffset write FSparseOffset;
|
|
property SparseSize:LongWord read FSparseSize write FSparseSize;
|
|
function HasFooter:Boolean;
|
Virtual disk VirtualBox extent
TVirtualDiskVboxExtent = class(TVirtualDiskExtent)
constructor Create(AImage:TVirtualDiskImage; ADelta,AParent:TVirtualDiskExtent);
|
|
destructor Destroy; override;
|
|
private
| |
FHeader:PVboxDiskHeader;
|
Header from Disk Extent |
FHeaderOffset:Int64;
|
Absolute byte offset of Header in file |
FHeaderSize:LongWord;
|
Size of Header in file |
protected
| |
FTable:TVirtualDiskVboxTable;
|
VirtualBox images contain only one Table per Extent |
public
| |
property Header:PVboxDiskHeader read FHeader;
|
|
property Table:TVirtualDiskVboxTable read FTable;
|
|
property HeaderOffset:Int64 read FHeaderOffset write FHeaderOffset;
|
|
property HeaderSize:LongWord read FHeaderSize write FHeaderSize;
|
Virtual disk table
TVirtualDiskTable = class(TListObject)
Note: Represents a Table of blocks within an Extent of a virtual disk | |
constructor Create(AImage:TVirtualDiskImage; AExtent:TVirtualDiskExtent);
|
|
destructor Destroy; override;
|
|
private
| |
protected
| |
FImage:TVirtualDiskImage;
|
|
FExtent:TVirtualDiskExtent;
|
|
FTableOffset:Int64;
|
Absolute byte offset of Table in file |
FTableSize:LongWord;
|
Size of Table data in file |
FStartSector:Int64;
|
First Sector represented by this Table |
FSectorCount:Int64;
|
Number of Sectors represented by this Table |
public
| |
property Image:TVirtualDiskImage read FImage;
|
|
property Extent:TVirtualDiskExtent read FExtent;
|
|
property TableOffset:Int64 read FTableOffset write FTableOffset;
|
|
property TableSize:LongWord read FTableSize write FTableSize;
|
|
property StartSector:Int64 read FStartSector write FStartSector;
|
|
property SectorCount:Int64 read FSectorCount write FSectorCount;
|
Virtual disk VMware table
TVirtualDiskVmwareTable = class(TVirtualDiskTable)
private
| |
protected
| |
public
| |
Virtual disk VPC table
TVirtualDiskVpcTable = class(TVirtualDiskTable)
constructor Create(AImage:TVirtualDiskImage; AExtent:TVirtualDiskExtent);
|
|
destructor Destroy; override;
|
|
private
| |
FData:Pointer;
|
|
protected
| |
public
| |
property Data:Pointer read FData write FData;
|
Virtual disk VirtualBox table
TVirtualDiskVboxTable = class(TVirtualDiskTable)
constructor Create(AImage:TVirtualDiskImage; AExtent:TVirtualDiskExtent);
|
|
destructor Destroy; override;
|
|
private
| |
FData:Pointer;
|
|
protected
| |
public
| |
property Data:Pointer read FData write FData;
|
Virtual disk block
TVirtualDiskBlock = class(TListObject)
Note: Represents a Block bitmap showing data allocation within a virtual disk | |
constructor Create(AImage:TVirtualDiskImage; ATable:TVirtualDiskTable);
|
|
destructor Destroy; override;
|
|
private
| |
protected
| |
FImage:TVirtualDiskImage;
|
|
FTable:TVirtualDiskTable;
|
|
FDataOffset:Int64;
|
Absolute byte offset of Data in file (Where Applicable) |
FBlockOffset:Int64;
|
Absolute byte offset of Block in file |
FBlockSize:LongWord;
|
Size of Block bitmap in file |
FStartSector:Int64;
|
First Sector represented by this Block |
FSectorCount:Int64;
|
Number of Sectors represented by this Block |
public
| |
property Image:TVirtualDiskImage read FImage;
|
|
property Table:TVirtualDiskTable read FTable;
|
|
property DataOffset:Int64 read FDataOffset write FDataOffset;
|
|
property BlockOffset:Int64 read FBlockOffset write FBlockOffset;
|
|
property BlockSize:LongWord read FBlockSize write FBlockSize;
|
|
property StartSector:Int64 read FStartSector write FStartSector;
|
|
property SectorCount:Int64 read FSectorCount write FSectorCount;
|
Virtual disk VMware block
TVirtualDiskVmwareBlock = class(TVirtualDiskBlock)
private
| |
protected
| |
public
| |
Virtual disk VPC group
TVirtualDiskVpcGroup = class(TListObject)
Note: Represents a Group of bitmap Blocks | |
constructor Create(AImage:TVirtualDiskImage; ATable:TVirtualDiskTable);
|
|
destructor Destroy; override;
|
|
private
| |
FGroupNo:LongWord;
|
|
protected
| |
FBlocks:TFileSysList;
|
Block bitmap Blocks |
FBlockLocal:TMutexHandle;
|
Local Lock shared by all Block bitmap Blocks |
public
| |
property GroupNo:LongWord read FGroupNo write FGroupNo;
|
|
property Blocks:TFileSysList read FBlocks;
|
Virtual disk VPC block
TVirtualDiskVpcBlock = class(TVirtualDiskBlock)
Note: VirtualBox images do not contain a bitmap, allocation granularity is per block | |
constructor Create(AImage:TVirtualDiskImage; ATable:TVirtualDiskTable);
|
|
destructor Destroy; override;
|
|
private
| |
FData:Pointer;
|
|
FBlockNo:LongWord;
|
|
protected
| |
public
| |
property Data:Pointer read FData write FData;
|
|
property BlockNo:LongWord read FBlockNo write FBlockNo;
|
Public variables
None defined
Function declarations
Initialization functions
procedure VirtualInit;
Note | None documented |
---|
procedure VirtualQuit;
Note | None documented |
---|
Virtual disk helper functions
function VirtualDataToPointer(const AData; ASize:Integer; ASwap:Boolean):Pointer;
Note | Allows byte order swapping on copy |
---|
function VirtualPointerToData(APointer:Pointer; var AData; ASize:Integer; ASwap:Boolean):Boolean;
Note | Allows byte order swapping on copy |
---|
function VirtualDataToString(const AData; ASize:Integer; AUnicode:Boolean):String;
Note | Accounts for unicode and byte ordering |
---|
function VirtualStringToData(const AString:String; var AData; ASize:Integer ;AUnicode:Boolean):Boolean;
Note | Accounts for unicode and byte ordering |
---|
Return to Unit Reference