VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/ExpandVolume/ExpandVolume.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-10-18 23:04:59 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-10-18 23:06:17 +0200
commit008d0503befa55311eb12dbca42a3df25c6f29a0 (patch)
treec6833aa593e57ef4c288eb9131d69066daff44ed /src/ExpandVolume/ExpandVolume.c
parent5b88a183ac297cbb7d332b23a6800bd4681da7db (diff)
downloadVeraCrypt-008d0503befa55311eb12dbca42a3df25c6f29a0.tar.gz
VeraCrypt-008d0503befa55311eb12dbca42a3df25c6f29a0.zip
Windows: make VeraCrypt Expander able to resume expansion of volumes whose previous expansion was aborted before it finishes
Diffstat (limited to 'src/ExpandVolume/ExpandVolume.c')
-rw-r--r--src/ExpandVolume/ExpandVolume.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/ExpandVolume/ExpandVolume.c b/src/ExpandVolume/ExpandVolume.c
index 5a476ba3..588e7688 100644
--- a/src/ExpandVolume/ExpandVolume.c
+++ b/src/ExpandVolume/ExpandVolume.c
@@ -750,13 +750,24 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
liNewSize.QuadPart=(LONGLONG)newHostSize;
- // Preallocate the file
- if (!SetFilePointerEx (dev, liNewSize, NULL, FILE_BEGIN)
- || !SetEndOfFile (dev)
- || SetFilePointer (dev, 0, NULL, FILE_BEGIN) != 0)
+ if (hostSize != newHostSize)
{
- nStatus = ERR_OS_ERROR;
- goto error;
+ // Preallocate the file
+ if (!SetFilePointerEx (dev, liNewSize, NULL, FILE_BEGIN)
+ || !SetEndOfFile (dev)
+ || SetFilePointer (dev, 0, NULL, FILE_BEGIN) != 0)
+ {
+ nStatus = ERR_OS_ERROR;
+ goto error;
+ }
+ }
+ else
+ {
+ if (SetFilePointer (dev, 0, NULL, FILE_BEGIN) != 0)
+ {
+ nStatus = ERR_OS_ERROR;
+ goto error;
+ }
}
}