Difference between revisions of "Unit VirtualDisk"
From Ultibo.org
Line 599: | Line 599: | ||
---- | ---- | ||
− | '' | + | |
+ | '''ESX sparse extent header''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PEsxSparseExtentHeader = ^TEsxSparseExtentHeader;</code> | ||
+ | |||
+ | <code>TEsxSparseExtentHeader = packed record </code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Always 2048 bytes (Only used for Delta disks, not Dynamic) | ||
+ | |- | ||
+ | | <code>magicNumber:LongWord;</code> | ||
+ | | 0x44574f43 / 'COWD' | ||
+ | |- | ||
+ | | <code>version:LongWord;</code> | ||
+ | | The value of this entry should be 1 | ||
+ | |- | ||
+ | | <code>flags:LongWord;</code> | ||
+ | | set to 3 | ||
+ | |- | ||
+ | | <code>numSectors:LongWord;</code> | ||
+ | | total number of sectors on the base disk | ||
+ | |- | ||
+ | | <code>grainSize:LongWord;</code> | ||
+ | | one sector by default. Can vary from one sector to 1MB | ||
+ | |- | ||
+ | | <code>gdOffset:LongWord;</code> | ||
+ | | starts at the fourth sector, because the COWDisk_Header structure takes four sectors | ||
+ | |- | ||
+ | | <code>numGDEntries:LongWord;</code> | ||
+ | | is CEILING(numSectors, gtCoverage) | ||
+ | |- | ||
+ | | <code>freeSector:LongWord;</code> | ||
+ | | the next free data sector. This needs to be less than the length of the delta link. It is initially set to gdOffset + numGDSectors | ||
+ | |- | ||
+ | | <code>case Integer of</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>0: (cylinders:LongWord;</code> | ||
+ | | root | ||
+ | |- | ||
+ | | <code>heads:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>sectors:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>generation:LongWord;</code> | ||
+ | | cont | ||
+ | |- | ||
+ | | <code>name:array[0..vmwareEsxSparseMaxNameLength - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>description:array[0..vmwareEsxSparseMaxDescriptionLength - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>savedGeneration:LongWord;</code> | ||
+ | | used to detect the unclean shutdown of the delta link. It is initially set to 0 | ||
+ | |- | ||
+ | | <code>reserved:array[0..7] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>uncleanShutdown:LongWord;</code> | ||
+ | | used to trigger the metadata consistency check in case there is an abnormal termination of the program | ||
+ | |- | ||
+ | | <code>padding:array[0..395] of Char);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>1: (parentFileName:array[0..vmwareEsxSparseMaxParentLength - 1] of Char;</code> | ||
+ | | child | ||
+ | |- | ||
+ | | <code>parentGeneration:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>generationx:LongWord;</code> | ||
+ | | cont | ||
+ | |- | ||
+ | | <code>namex:array[0..vmwareEsxSparseMaxNameLength - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>descriptionx:array[0..vmwareEsxSparseMaxDescriptionLength - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>savedGenerationx:LongWord;</code> | ||
+ | | used to detect the unclean shutdown of the delta link. It is initially set to 0 | ||
+ | |- | ||
+ | | <code>reservedx:array[0..7] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>uncleanShutdownx:LongWord;</code> | ||
+ | | used to trigger the metadata consistency check in case there is an abnormal termination of the program | ||
+ | |- | ||
+ | | <code>paddingx:array[0..395] of Char);</code> | ||
+ | | remaining fields are not used. They are present to maintain compatibility with legacy virtual disk formats | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''VMware sparse extent header''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PVmwareSparseExtentHeader = ^TVmwareSparseExtentHeader;</code> | ||
+ | |||
+ | <code>TVmwareSparseExtentHeader = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Always 512 bytes (Used for both Dynamic and Delta disks) | ||
+ | |- | ||
+ | | <code>magicNumber:LongWord;</code> | ||
+ | | 0x564d444b / 'VMDK' | ||
+ | |- | ||
+ | | <code>version:LongWord;</code> | ||
+ | | The value of this entry should be 1 | ||
+ | |- | ||
+ | | <code>flags:LongWord;</code> | ||
+ | | See above | ||
+ | |- | ||
+ | | <code>capacity:Int64;</code> | ||
+ | | the capacity of this extent in sectors (should be a multiple of the grain size) | ||
+ | |- | ||
+ | | <code>grainSize:Int64;</code> | ||
+ | | size of a grain in sectors (must be a power of 2 and must be greater than 8 (4KB)) | ||
+ | |- | ||
+ | | <code>descriptorOffset:Int64;</code> | ||
+ | | offset of the embedded descriptor in the extent (expressed in sectors) | ||
+ | |- | ||
+ | | <code>descriptorSize:Int64;</code> | ||
+ | | valid only if descriptorOffset is non-zero (expressed in sectors) | ||
+ | |- | ||
+ | | <code>numGTEsPerGT:LongWord;</code> | ||
+ | | the number of entries in a grain table (for VMware virtual disks is 512) | ||
+ | |- | ||
+ | | <code>rgdOffset:Int64;</code> | ||
+ | | redundant level 0 of metadata (expressed in sectors) | ||
+ | |- | ||
+ | | <code>gdOffset:Int64;</code> | ||
+ | | level 0 of metadata (expressed in sectors) | ||
+ | |- | ||
+ | | <code>overHead:Int64;</code> | ||
+ | | number of sectors occupied by the metadata | ||
+ | |- | ||
+ | | <code>uncleanShutdown:ByteBool;</code> | ||
+ | | 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 | ||
+ | |- | ||
+ | | <code>singleEndLineChar:Char;</code> | ||
+ | | '\n' | ||
+ | |- | ||
+ | | <code>nonEndLineChar:Char;</code> | ||
+ | | ' ' | ||
+ | |- | ||
+ | | <code>doubleEndLineChar1:Char;</code> | ||
+ | | '\r' | ||
+ | |- | ||
+ | | <code>doubleEndLineChar2:Char;</code> | ||
+ | | '\n' | ||
+ | |- | ||
+ | | <code>compressAlgorithm:Word;</code> | ||
+ | | See above | ||
+ | |- | ||
+ | | <code>pad:array[0..432] of Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Microsoft virtual PC dish geometry''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PVpcDiskGeometry = ^TVpcDiskGeometry;</code> | ||
+ | |||
+ | <code>TVpcDiskGeometry = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Always 4 bytes | ||
+ | |- | ||
+ | | <code>Cylinders:Word;</code> | ||
+ | | Cylinders | ||
+ | |- | ||
+ | | <code>Heads:Byte;</code> | ||
+ | | Heads | ||
+ | |- | ||
+ | | <code>Sectors:Byte;</code> | ||
+ | | Sectors per track | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Microsoft virtual PC parent locator''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PVpcParentLocator = ^TVpcParentLocator;</code> | ||
+ | |||
+ | <code>TVpcParentLocator = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Always 24 bytes | ||
+ | |- | ||
+ | | <code>PlatformCode:LongWord;</code> | ||
+ | | describes which platform-specific format is used for the file locator (see above) | ||
+ | |- | ||
+ | | <code>PlatformDataSpace:LongWord;</code> | ||
+ | | the number of 512-byte sectors needed to store the parent hard disk locator | ||
+ | |- | ||
+ | | <code>PlatformDataLength:LongWord;</code> | ||
+ | | length of the parent hard disk locator in bytes | ||
+ | |- | ||
+ | | <code>Reserved:LongWord;</code> | ||
+ | | Reserved, must be zero | ||
+ | |- | ||
+ | | <code>PlatformDataOffset:Int64;</code> | ||
+ | | offset in bytes where the platform specific file locator data is stored | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Microsoft virtual PC hard disk footer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PVpcHardDiskFooter = ^TVpcHardDiskFooter;</code> | ||
+ | |||
+ | <code>TVpcHardDiskFooter = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Always 512 bytes (At end of file on Fixed disks, at start and end on Dynamic and Differencing disks) | ||
+ | |- | ||
+ | | <code>Cookie:array[0..7] of Char;</code> | ||
+ | | conectix | ||
+ | |- | ||
+ | | <code>Features:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Version:LongWord;</code> | ||
+ | | 0x00010000 | ||
+ | |- | ||
+ | | <code>DataOffset:Int64;</code> | ||
+ | | Offset to Dynamic Disk Header, Must be 0xFFFFFFFF for Fixed Disks | ||
+ | |- | ||
+ | | <code>TimeStamp:LongWord;</code> | ||
+ | | seconds since January 1, 2000 12:00:00 AM in UTC/GMT (Unix Time minus 30 years) | ||
+ | |- | ||
+ | | <code>CreatorApplication:array[0..3] of Char;</code> | ||
+ | | Microsoft Virtual PC = "vpc " / Microsoft Virtual Server = "vs " | ||
+ | |- | ||
+ | | <code>CreatorVersion:LongWord;</code> | ||
+ | | Virtual Server 2004 = 0x00010000 / Virtual PC 2004 = 0x00050000 | ||
+ | |- | ||
+ | | <code>CreatorHostOS:LongWord;</code> | ||
+ | | Windows 0x5769326B (Wi2k) / Macintosh 0x4D616320 (Mac ) | ||
+ | |- | ||
+ | | <code>OriginalSize:Int64;</code> | ||
+ | | Size in Bytes of the VHD at Creation | ||
+ | |- | ||
+ | | <code>CurrentSize:Int64;</code> | ||
+ | | Current Size in Bytes of the VHD | ||
+ | |- | ||
+ | | <code>DiskGeometry:TVpcDiskGeometry;</code> | ||
+ | | See above | ||
+ | |- | ||
+ | | <code>DiskType:LongWord;</code> | ||
+ | | See above | ||
+ | |- | ||
+ | | <code>Checksum:LongWord;</code> | ||
+ | | 1s compliment checksum of the footer | ||
+ | |- | ||
+ | | <code>UniqueId:TGUID;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SavedState:ByteBool;</code> | ||
+ | | Set to 1 if disk is in a saved state | ||
+ | |- | ||
+ | | <code>Reserved:array[0..426] of Byte;</code> | ||
+ | | Reserved, must be zero | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Microsoft virtual PC dynaic disk header''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PVpcDynamicDiskHeader = ^TVpcDynamicDiskHeader;</code> | ||
+ | |||
+ | <code>TVpcDynamicDiskHeader = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Always 1024 bytes (Used for both Dynamic and Differencing disks) | ||
+ | |- | ||
+ | | <code>Cookie:array[0..7] of Char;</code> | ||
+ | | cxsparse | ||
+ | |- | ||
+ | | <code>DataOffset:Int64;</code> | ||
+ | | currently unused by existing formats and should be set to 0xFFFFFFFF | ||
+ | |- | ||
+ | | <code>TableOffset:Int64;</code> | ||
+ | | absolute byte offset of the Block Allocation Table (BAT) | ||
+ | |- | ||
+ | | <code>HeaderVersion:LongWord;</code> | ||
+ | | must be initialized to 0x00010000 | ||
+ | |- | ||
+ | | <code>MaxTableEntries:LongWord;</code> | ||
+ | | maximum entries present in the BAT. equal to the number of blocks in the disk (disk size divided by the blocksize) | ||
+ | |- | ||
+ | | <code>BlockSize:LongWord;</code> | ||
+ | | The default value is 0x00200000 (indicating a block size of 2 MB) | ||
+ | |- | ||
+ | | <code>Checksum:LongWord;</code> | ||
+ | | 1s compliment checksum of the header | ||
+ | |- | ||
+ | | <code>ParentUniqueId:TGUID;</code> | ||
+ | | only used for differencing hard disks | ||
+ | |- | ||
+ | | <code>ParentTimeStamp:LongWord;</code> | ||
+ | | number of seconds since January 1, 2000 12:00:00 AM in UTC/GMT | ||
+ | |- | ||
+ | | <code>Reserved1:LongWord;</code> | ||
+ | | Must be zero | ||
+ | |- | ||
+ | | <code>ParentUnicodeName:array[0..255] of WideChar;</code> | ||
+ | | parent hard disk filename (Unicode /UTF16 string) | ||
+ | |- | ||
+ | | <code>ParentLocator1:TVpcParentLocator;</code> | ||
+ | | These entries store an absolute byte offset in the file where the parent locator for a differencing hard disk is stored | ||
+ | |- | ||
+ | | <code>ParentLocator2:TVpcParentLocator;</code> | ||
+ | | These fields are used only for differencing disks and should be set to zero for dynamic disks | ||
+ | |- | ||
+ | | <code>ParentLocator3:TVpcParentLocator;</code> | ||
+ | | These fields are used only for differencing disks and should be set to zero for dynamic disks | ||
+ | |- | ||
+ | | <code>ParentLocator4:TVpcParentLocator;</code> | ||
+ | | These fields are used only for differencing disks and should be set to zero for dynamic disks | ||
+ | |- | ||
+ | | <code>ParentLocator5:TVpcParentLocator;</code> | ||
+ | | These fields are used only for differencing disks and should be set to zero for dynamic disks | ||
+ | |- | ||
+ | | <code>ParentLocator6:TVpcParentLocator;</code> | ||
+ | | These fields are used only for differencing disks and should be set to zero for dynamic disks | ||
+ | |- | ||
+ | | <code>ParentLocator7:TVpcParentLocator;</code> | ||
+ | | These fields are used only for differencing disks and should be set to zero for dynamic disks | ||
+ | |- | ||
+ | | <code>ParentLocator8:TVpcParentLocator;</code> | ||
+ | | These fields are used only for differencing disks and should be set to zero for dynamic disks | ||
+ | |- | ||
+ | | <code>Reserved2:array[0..255] of Byte;</code> | ||
+ | | Reserved, must be zero | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''VirtualBox disk header''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PVboxDiskHeader = ^TVboxDiskHeader;</code> | ||
+ | |||
+ | <code>TVboxDiskHeader = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Always 512 bytes (At start of file for both Fixed and Dynamic disks) | ||
+ | |- | ||
+ | | <code>Banner:array[0..63] of Char;</code> | ||
+ | | <<< Sun xVM VirtualBox Disk Image >>> | ||
+ | |- | ||
+ | | <code>Signature:LongWord;</code> | ||
+ | | 7F 10 DA BE | ||
+ | |- | ||
+ | | <code>Version:LongWord;</code> | ||
+ | | 1.1 | ||
+ | |- | ||
+ | | <code>HeaderSize:LongWord;</code> | ||
+ | | 0x190 | ||
+ | |- | ||
+ | | <code>DiskType:LongWord;</code> | ||
+ | | see above | ||
+ | |- | ||
+ | | <code>DiskFlags:LongWord;</code> | ||
+ | | see above | ||
+ | |- | ||
+ | | <code>Description:array[0..255] of Char;</code> | ||
+ | | Unused | ||
+ | |- | ||
+ | | <code>BlocksOffset:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DataOffset:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Cylinders:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Heads:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Sectors:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SectorSize:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Reserved1:LongWord;</code> | ||
+ | | Must be zero | ||
+ | |- | ||
+ | | <code>DiskSize:Int64;</code> | ||
+ | | Bytes | ||
+ | |- | ||
+ | | <code>BlockSize:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>BlockExtra:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>TotalBlocks:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>AllocatedBlocks:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>UUID:TGUID;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SnapshotUUID:TGUID;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>LinkUUID:TGUID;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ParentUUID:TGUID;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Unknown1:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Unknown2:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Reserved2:LongWord;</code> | ||
+ | | Must be 0x3F | ||
+ | |- | ||
+ | | <code>Reserved3:LongWord;</code> | ||
+ | | Must be 0x200 | ||
+ | |- | ||
+ | | <code>Unused:array[0..9] of LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Class definitions === | === Class definitions === |
Revision as of 05:08, 26 January 2017
Return to Unit Reference
Contents
[hide]Description
Ultibo Virtual Disk interface unit
To be documented
Constants
[Expand]
Virtual disk specific constants
VIRTUAL_*
[Expand]
Virtual flag contants
virtualFlag*
[Expand]
VMware constants
vmware*
[Expand]
VMware disk type constants
vmware*DiskType
[Expand]
VMware descriptor tag constants
vmwareTag*
[Expand]
VMware create type constants
vmwareCreateType_*
[Expand]
VMware access type constants
vmwareAccessType_*
[Expand]
VMware extent type constants
vmwareExtentType_*
[Expand]
VMware disk flag constants
vmwareFlag*
[Expand]
VMware compression type constants
vmwareCompression*
[Expand]
VPC constants
vpc*
[Expand]
VPC disk type constants
vpcDiskType*
[Expand]
VPC feature constants
vpcFeature*
[Expand]
VPC creator host OS constants
vpcCreator*
[Expand]
VPC platform code constants
vpcPlatform*
[Expand]
VPC bitmap mask constants
vpcBitmapMask*
[Expand]
VirtualBox constants
vbox*
[Expand]
VirtualBox disk type constants
vboxDiskType*
[Expand]
VirtualBox disk flag constants
vboxDiskFlags*
Type definitions
ESX sparse extent header
VMware sparse extent header
[Expand]
PVmwareSparseExtentHeader = ^TVmwareSparseExtentHeader;
TVmwareSparseExtentHeader = packed record
Microsoft virtual PC dish geometry
Microsoft virtual PC parent locator
Microsoft virtual PC hard disk footer
Microsoft virtual PC dynaic disk header
VirtualBox disk header
Class definitions
To be documented
Public variables
None defined
Function declarations
Initialization functions
Virtual disk helper functions
[Expand]
function VirtualDataToPointer(const AData; ASize:Integer; ASwap:Boolean):Pointer;
Description: Creates a pointer and copies data from a buffer
[Expand]
function VirtualPointerToData(APointer:Pointer; var AData; ASize:Integer; ASwap:Boolean):Boolean;
Description: Copies data to a buffer from supplied pointer
[Expand]
function VirtualDataToString(const AData; ASize:Integer; AUnicode:Boolean):String;
Description: Converts the supplied data to a string
[Expand]
function VirtualStringToData(const AString:String; var AData; ASize:Integer ;AUnicode:Boolean):Boolean;
Description: Converts the supplied string to data
Return to Unit Reference