mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
Windows: use IOCTL_DISK_GET_DRIVE_GEOMETRY_EX instead of the deprecated IOCTL_DISK_GET_DRIVE_GEOMETRY in order to get accurate disk size value.
This commit is contained in:
@@ -559,18 +559,17 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
|
||||
}
|
||||
else
|
||||
{
|
||||
DISK_GEOMETRY driveInfo;
|
||||
DISK_GEOMETRY_EX driveInfo;
|
||||
|
||||
bResult = DeviceIoControl (dev, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0,
|
||||
bResult = DeviceIoControl (dev, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0,
|
||||
&driveInfo, sizeof (driveInfo), &dwResult, NULL);
|
||||
|
||||
if (!bResult)
|
||||
goto error;
|
||||
|
||||
hostSize = driveInfo.Cylinders.QuadPart * driveInfo.BytesPerSector *
|
||||
driveInfo.SectorsPerTrack * driveInfo.TracksPerCylinder;
|
||||
hostSize = driveInfo.DiskSize.QuadPart;
|
||||
|
||||
HostSectorSize = driveInfo.BytesPerSector;
|
||||
HostSectorSize = driveInfo.Geometry.BytesPerSector;
|
||||
}
|
||||
|
||||
if (hostSize == 0)
|
||||
|
||||
Reference in New Issue
Block a user