VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Password.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2017-07-27 00:02:20 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-07-27 00:30:53 +0200
commit72b7147021a18ea6a045514fa7cad7772c4bb811 (patch)
tree887444e7b44b2c4046d1553524a86d0c0f9556c7 /src/Common/Password.c
parentc29ee8331afa52f72df5fb21daa02457243650fe (diff)
downloadVeraCrypt-72b7147021a18ea6a045514fa7cad7772c4bb811.tar.gz
VeraCrypt-72b7147021a18ea6a045514fa7cad7772c4bb811.zip
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).
Diffstat (limited to 'src/Common/Password.c')
-rw-r--r--src/Common/Password.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Common/Password.c b/src/Common/Password.c
index 8ba91374..5643cef0 100644
--- a/src/Common/Password.c
+++ b/src/Common/Password.c
@@ -187,7 +187,6 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
BOOL bTimeStampValid = FALSE;
LARGE_INTEGER headerOffset;
BOOL backupHeader;
- DISK_GEOMETRY_EX driveInfo;
if (oldPassword->Length == 0 || newPassword->Length == 0) return -1;
@@ -236,12 +235,13 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
}
else
{
+ BYTE dgBuffer[256];
PARTITION_INFORMATION diskInfo;
DWORD dwResult;
BOOL bResult;
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;
@@ -254,7 +254,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
}
else
{
- hostSize = driveInfo.DiskSize.QuadPart;
+ hostSize = ((PDISK_GEOMETRY_EX) dgBuffer)->DiskSize.QuadPart;
}
if (hostSize == 0)