mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-10 21:23:40 +01:00
Windows: make VeraCrypt Expander able to resume expansion of volumes whose previous expansion was aborted before it finishes
This commit is contained in:
parent
5b88a183ac
commit
008d0503be
@ -717,7 +717,7 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume)
|
||||
|
||||
if ( !bIsDevice )
|
||||
{
|
||||
if ( newVolumeSize < hostSize + TC_MINVAL_FS_EXPAND)
|
||||
if ( (newVolumeSize < hostSize + TC_MINVAL_FS_EXPAND) && ((hostSize == volSize) || (newVolumeSize != hostSize) || ((hostSize - volSize) < TC_MINVAL_FS_EXPAND)))
|
||||
{
|
||||
StringCbPrintfW(szTmp,sizeof(szTmp),L"New volume size too small, must be at least %I64u kB larger than the current size.",TC_MINVAL_FS_EXPAND/BYTES_PER_KB);
|
||||
MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_OK | MB_ICONEXCLAMATION );
|
||||
|
@ -750,6 +750,8 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
|
||||
|
||||
liNewSize.QuadPart=(LONGLONG)newHostSize;
|
||||
|
||||
if (hostSize != newHostSize)
|
||||
{
|
||||
// Preallocate the file
|
||||
if (!SetFilePointerEx (dev, liNewSize, NULL, FILE_BEGIN)
|
||||
|| !SetEndOfFile (dev)
|
||||
@ -759,6 +761,15 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SetFilePointer (dev, 0, NULL, FILE_BEGIN) != 0)
|
||||
{
|
||||
nStatus = ERR_OS_ERROR;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (initFreeSpace)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user