Changeset 24527 in vbox
- Timestamp:
- Nov 9, 2009 8:39:29 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 54631
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp
r24150 r24527 1727 1727 /* Initialize BAT. */ 1728 1728 pImage->uBlockAllocationTableOffset = (uint64_t)sizeof(VHDFooter) + sizeof(VHDDynamicDiskHeader); 1729 pImage->cBlockAllocationTableEntries = (uint32_t)( cbSize / pImage->cbDataBlock);1729 pImage->cBlockAllocationTableEntries = (uint32_t)((cbSize + pImage->cbDataBlock - 1) / pImage->cbDataBlock); /* Align table to the block size. */ 1730 1730 u32BlockAllocationTableSectors = (pImage->cBlockAllocationTableEntries * sizeof(uint32_t) + VHD_SECTOR_SIZE - 1) / VHD_SECTOR_SIZE; 1731 1731 pImage->pBlockAllocationTable = (uint32_t *)RTMemAllocZ(pImage->cBlockAllocationTableEntries * sizeof(uint32_t)); … … 1737 1737 pImage->pBlockAllocationTable[i] = 0xFFFFFFFF; /* It is actually big endian. */ 1738 1738 } 1739 1739 1740 /* Round up to the sector size. */ 1740 pImage->uCurrentEndOfFile = vhdAllocateParentLocators(pImage, &DynamicDiskHeader, 1741 pImage->uBlockAllocationTableOffset + u32BlockAllocationTableSectors * VHD_SECTOR_SIZE); 1741 if (pImage->uImageFlags & VD_IMAGE_FLAGS_DIFF) /* fix hyper-v unreadable error */ 1742 pImage->uCurrentEndOfFile = vhdAllocateParentLocators(pImage, &DynamicDiskHeader, 1743 pImage->uBlockAllocationTableOffset + u32BlockAllocationTableSectors * VHD_SECTOR_SIZE); 1744 else 1745 pImage->uCurrentEndOfFile = pImage->uBlockAllocationTableOffset + u32BlockAllocationTableSectors * VHD_SECTOR_SIZE; 1742 1746 1743 1747 /* Set dynamic image size. */
Note:
See TracChangeset
for help on using the changeset viewer.