public DynamicDiskHeader(byte[] buffer) { Cookie = ByteReader.ReadAnsiString(buffer, 0x00, 8); DataOffset = BigEndianConverter.ToUInt64(buffer, 0x08); TableOffset = BigEndianConverter.ToUInt64(buffer, 0x10); HeaderVersion = BigEndianConverter.ToUInt32(buffer, 0x18); MaxTableEntries = BigEndianConverter.ToUInt32(buffer, 0x1C); BlockSize = BigEndianConverter.ToUInt32(buffer, 0x20); uint checksum = BigEndianConverter.ToUInt32(buffer, 0x24); ParentUniqueID = BigEndianConverter.ToGuid(buffer, 0x28); ParentTimeStamp = BigEndianConverter.ToUInt32(buffer, 0x38); Reserved = BigEndianConverter.ToUInt32(buffer, 0x3C); ParentUnicodeName = ByteReader.ReadUTF16String(buffer, 0x40, 256).TrimEnd('\0'); ParentLocatorEntry1 = new ParentLocatorEntry(buffer, 0x240); ParentLocatorEntry2 = new ParentLocatorEntry(buffer, 0x258); ParentLocatorEntry3 = new ParentLocatorEntry(buffer, 0x270); ParentLocatorEntry4 = new ParentLocatorEntry(buffer, 0x288); ParentLocatorEntry5 = new ParentLocatorEntry(buffer, 0x2A0); ParentLocatorEntry6 = new ParentLocatorEntry(buffer, 0x2B8); ParentLocatorEntry7 = new ParentLocatorEntry(buffer, 0x2D0); ParentLocatorEntry8 = new ParentLocatorEntry(buffer, 0x2E8); byte[] temp = (byte[])buffer.Clone(); BigEndianWriter.WriteInt32(temp, 0x24, 0); uint expectedChecksum = VHDFooter.CalculateChecksum(temp); m_isValid = String.Equals(Cookie, DynamidDiskHeaderCookie) && (checksum == expectedChecksum) && (HeaderVersion == 0x00010000); }
public DynamicDiskHeader() { Cookie = DynamidDiskHeaderCookie; DataOffset = 0xFFFFFFFFFFFFFFFF; HeaderVersion = 0x00010000; ParentLocatorEntry1 = new ParentLocatorEntry(); ParentLocatorEntry2 = new ParentLocatorEntry(); ParentLocatorEntry3 = new ParentLocatorEntry(); ParentLocatorEntry4 = new ParentLocatorEntry(); ParentLocatorEntry5 = new ParentLocatorEntry(); ParentLocatorEntry6 = new ParentLocatorEntry(); ParentLocatorEntry7 = new ParentLocatorEntry(); ParentLocatorEntry8 = new ParentLocatorEntry(); }