VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2025-02-03 23:48:51 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2025-02-03 23:48:51 +0100
commite73ea7193e6fed6d347893816a8fd5a0aadec4cc (patch)
tree858171067435cb0b47f9e9157231ebabc640327f /src
parent6cd32af1c1ed8ab98b7a34adc81be48c0728fe3d (diff)
downloadVeraCrypt-e73ea7193e6fed6d347893816a8fd5a0aadec4cc.tar.gz
VeraCrypt-e73ea7193e6fed6d347893816a8fd5a0aadec4cc.zip
Widnows driver: use correct value for HiddenSectors field in structures to match read MBR disks
Diffstat (limited to 'src')
-rw-r--r--src/Driver/Ntdriver.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c
index 65423829..1b6bab01 100644
--- a/src/Driver/Ntdriver.c
+++ b/src/Driver/Ntdriver.c
@@ -1228,7 +1228,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
outputBuffer->StartingOffset.QuadPart = BYTES_PER_MB; // Set offset to 1MB to emulate the partition offset on a real MBR disk
outputBuffer->PartitionLength.QuadPart= Extension->DiskLength;
outputBuffer->PartitionNumber = 1;
- outputBuffer->HiddenSectors = 0;
+ outputBuffer->HiddenSectors = BYTES_PER_MB / Extension->BytesPerSector;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof (PARTITION_INFORMATION);
}
@@ -1248,7 +1248,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
outputBuffer->Mbr.PartitionType = Extension->PartitionType;
outputBuffer->Mbr.BootIndicator = FALSE;
outputBuffer->Mbr.RecognizedPartition = TRUE;
- outputBuffer->Mbr.HiddenSectors = 0;
+ outputBuffer->Mbr.HiddenSectors = BYTES_PER_MB / Extension->BytesPerSector;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof (PARTITION_INFORMATION_EX);
}
@@ -1272,7 +1272,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
outputBuffer->PartitionEntry->StartingOffset.QuadPart = BYTES_PER_MB; // Set offset to 1MB to emulate the partition offset on a real MBR disk
outputBuffer->PartitionEntry->PartitionLength.QuadPart = Extension->DiskLength;
outputBuffer->PartitionEntry->PartitionNumber = 1;
- outputBuffer->PartitionEntry->HiddenSectors = 0;
+ outputBuffer->PartitionEntry->HiddenSectors = BYTES_PER_MB / Extension->BytesPerSector;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof (DRIVE_LAYOUT_INFORMATION);
@@ -1307,7 +1307,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
outputBuffer->PartitionEntry->StartingOffset.QuadPart = BYTES_PER_MB; // Set offset to 1MB to emulate the partition offset on a real MBR disk
outputBuffer->PartitionEntry->PartitionLength.QuadPart = Extension->DiskLength;
outputBuffer->PartitionEntry->PartitionNumber = 1;
- outputBuffer->PartitionEntry->Mbr.HiddenSectors = 0;
+ outputBuffer->PartitionEntry->Mbr.HiddenSectors = BYTES_PER_MB / Extension->BytesPerSector;
outputBuffer->PartitionEntry->Mbr.PartitionType = Extension->PartitionType;
Irp->IoStatus.Status = STATUS_SUCCESS;