1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 19:08:26 -06:00

Windows: Fix failure to format some disks (e.g. VHDX) caused by partition offset not 4K aligned

Now we set offset to 1MB which is a typical values used for MBR disks.
We also use a more standard way to calculate legacy number of cylinders
This commit is contained in:
Mounir IDRASSI
2023-11-08 22:43:18 +01:00
parent e70aa13c5b
commit 1688779bc3
2 changed files with 10 additions and 11 deletions

View File

@@ -798,8 +798,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
Extension->TracksPerCylinder = 1;
Extension->SectorsPerTrack = 1;
Extension->BytesPerSector = Extension->cryptoInfo->SectorSize;
// Add extra sector since our virtual partition starts at Extension->BytesPerSector and not 0
Extension->NumberOfCylinders = (Extension->DiskLength / Extension->BytesPerSector) + 1;
Extension->NumberOfCylinders = Extension->DiskLength / Extension->BytesPerSector;
Extension->PartitionType = 0;
Extension->bRawDevice = bRawDevice;