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

Windows: use large output buffer for IOCTL_DISK_GET_DRIVE_GEOMETRY_EX calls to avoid failure with disk drivers that don't support returning only sizeof(DISK_GEOMETRY_EX).

This commit is contained in:
Mounir IDRASSI
2017-07-27 00:02:20 +02:00
parent c29ee8331a
commit 72b7147021
5 changed files with 160 additions and 157 deletions

View File

@@ -559,17 +559,17 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
}
else
{
DISK_GEOMETRY_EX driveInfo;
BYTE dgBuffer[256];
bResult = DeviceIoControl (dev, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0,
&driveInfo, sizeof (driveInfo), &dwResult, NULL);
dgBuffer, sizeof (dgBuffer), &dwResult, NULL);
if (!bResult)
goto error;
hostSize = driveInfo.DiskSize.QuadPart;
hostSize = ((PDISK_GEOMETRY_EX) dgBuffer)->DiskSize.QuadPart;
HostSectorSize = driveInfo.Geometry.BytesPerSector;
HostSectorSize = ((PDISK_GEOMETRY_EX) dgBuffer)->Geometry.BytesPerSector;
}
if (hostSize == 0)