mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
Windows: Fix expansion of volumes on devices with sector size!=512 (by skl0n6)
This commit is contained in:
@@ -508,6 +508,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
|
|||||||
PCRYPTO_INFO cryptoInfo = NULL, ci = NULL;
|
PCRYPTO_INFO cryptoInfo = NULL, ci = NULL;
|
||||||
void *dev = INVALID_HANDLE_VALUE;
|
void *dev = INVALID_HANDLE_VALUE;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
DWORD bytesRead;
|
||||||
BOOL bDevice;
|
BOOL bDevice;
|
||||||
uint64 hostSize=0, newDataAreaSize, currentVolSize;
|
uint64 hostSize=0, newDataAreaSize, currentVolSize;
|
||||||
DWORD HostSectorSize;
|
DWORD HostSectorSize;
|
||||||
@@ -672,8 +673,13 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Read in volume header */
|
/* Read in volume header */
|
||||||
nStatus = _lread ((HFILE) dev, buffer, sizeof (buffer));
|
if (!ReadEffectiveVolumeHeader (bDevice, dev, buffer, &bytesRead))
|
||||||
if (nStatus != sizeof (buffer))
|
{
|
||||||
|
nStatus = ERR_OS_ERROR;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bytesRead != sizeof (buffer))
|
||||||
{
|
{
|
||||||
// Windows may report EOF when reading sectors from the last cluster of a device formatted as NTFS
|
// Windows may report EOF when reading sectors from the last cluster of a device formatted as NTFS
|
||||||
memset (buffer, 0, sizeof (buffer));
|
memset (buffer, 0, sizeof (buffer));
|
||||||
|
|||||||
Reference in New Issue
Block a user