VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-12-08 22:51:49 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-12-08 23:42:47 +0100
commit5e96a5c44c3c78a901d77297517fa4842a297eb9 (patch)
treec96c1f8cfc13c9435d26d31d267a5a125493349d /src/Mount
parent7f1e21e6a1103fd4a488ddbe63571c6ffecb38ca (diff)
downloadVeraCrypt-5e96a5c44c3c78a901d77297517fa4842a297eb9.tar.gz
VeraCrypt-5e96a5c44c3c78a901d77297517fa4842a297eb9.zip
Windows: enhancements to the mechanism preserving file timestamps, especially for keyfiles.
Diffstat (limited to 'src/Mount')
-rw-r--r--src/Mount/Mount.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 54dc8158..9130eaee 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -10861,6 +10861,21 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
nStatus = ERR_OS_ERROR;
goto error;
}
+ else if (!bDevice && bPreserveTimestamp)
+ {
+ // ensure that Last Access timestamp is not modified
+ ftLastAccessTime.dwHighDateTime = 0xFFFFFFFF;
+ ftLastAccessTime.dwLowDateTime = 0xFFFFFFFF;
+
+ SetFileTime (dev, NULL, &ftLastAccessTime, NULL);
+
+ /* Remember the container modification/creation date and time. */
+
+ if (GetFileTime ((HANDLE) dev, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime) == 0)
+ bTimeStampValid = FALSE;
+ else
+ bTimeStampValid = TRUE;
+ }
// Determine volume host size
if (bDevice)
@@ -10931,15 +10946,6 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
hostSize = fileSize.QuadPart;
}
- if (!bDevice && bPreserveTimestamp)
- {
- /* Remember the container modification/creation date and time. */
-
- if (GetFileTime ((HANDLE) dev, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime) == 0)
- bTimeStampValid = FALSE;
- else
- bTimeStampValid = TRUE;
- }
/* Read the volume header from the backup file */
char buffer[TC_VOLUME_HEADER_GROUP_SIZE];