From 72b7147021a18ea6a045514fa7cad7772c4bb811 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Thu, 27 Jul 2017 00:02:20 +0200 Subject: 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). --- src/Common/Password.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Common/Password.c') 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) -- cgit v1.2.3