VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Driver/Ntvol.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-11-08 22:43:18 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-11-08 22:43:18 +0100
commit1688779bc38d408e1566320746adbdaa8bdf67d1 (patch)
tree11a557558a97d1f95eb1e7673cf234e9966a771c /src/Driver/Ntvol.c
parente70aa13c5bd0e870c11596cf5d4c7dd0e343aef0 (diff)
downloadVeraCrypt-1688779bc38d408e1566320746adbdaa8bdf67d1.tar.gz
VeraCrypt-1688779bc38d408e1566320746adbdaa8bdf67d1.zip
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
Diffstat (limited to 'src/Driver/Ntvol.c')
-rw-r--r--src/Driver/Ntvol.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/Driver/Ntvol.c b/src/Driver/Ntvol.c
index 6f2ff399..444468c5 100644
--- a/src/Driver/Ntvol.c
+++ b/src/Driver/Ntvol.c
@@ -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;