mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-09-19 20:36:18 +02:00
Windows: Fix expansion of volumes on devices with sector size!=512 (by skl0n6)
This commit is contained in:
parent
847abb23f0
commit
35135cd1fb
@ -508,6 +508,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
|
||||
PCRYPTO_INFO cryptoInfo = NULL, ci = NULL;
|
||||
void *dev = INVALID_HANDLE_VALUE;
|
||||
DWORD dwError;
|
||||
DWORD bytesRead;
|
||||
BOOL bDevice;
|
||||
uint64 hostSize=0, newDataAreaSize, currentVolSize;
|
||||
DWORD HostSectorSize;
|
||||
@ -672,8 +673,13 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
|
||||
}
|
||||
|
||||
/* Read in volume header */
|
||||
nStatus = _lread ((HFILE) dev, buffer, sizeof (buffer));
|
||||
if (nStatus != sizeof (buffer))
|
||||
if (!ReadEffectiveVolumeHeader (bDevice, dev, buffer, &bytesRead))
|
||||
{
|
||||
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
|
||||
memset (buffer, 0, sizeof (buffer));
|
||||
|
Loading…
Reference in New Issue
Block a user