VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Password.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2017-05-15 16:22:48 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-05-17 00:46:41 +0200
commit74b82118d5f77116ec5f4a1e2438cdc77cead40f (patch)
treee482a6872cfd4605c1379c469870ea2303273031 /src/Common/Password.c
parentce4e7fd64d3d462a523253dd53fb36f3aebd179a (diff)
downloadVeraCrypt-74b82118d5f77116ec5f4a1e2438cdc77cead40f.tar.gz
VeraCrypt-74b82118d5f77116ec5f4a1e2438cdc77cead40f.zip
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.
Diffstat (limited to 'src/Common/Password.c')
-rw-r--r--src/Common/Password.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Common/Password.c b/src/Common/Password.c
index 1c9083a3..b51870f9 100644
--- a/src/Common/Password.c
+++ b/src/Common/Password.c
@@ -186,7 +186,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
BOOL bTimeStampValid = FALSE;
LARGE_INTEGER headerOffset;
BOOL backupHeader;
- DISK_GEOMETRY driveInfo;
+ DISK_GEOMETRY_EX driveInfo;
if (oldPassword->Length == 0 || newPassword->Length == 0) return -1;
@@ -239,7 +239,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
DWORD dwResult;
BOOL bResult;
- 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)
@@ -253,8 +253,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
}
else
{
- hostSize = driveInfo.Cylinders.QuadPart * driveInfo.BytesPerSector *
- driveInfo.SectorsPerTrack * driveInfo.TracksPerCylinder;
+ hostSize = driveInfo.DiskSize.QuadPart;
}
if (hostSize == 0)