VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Format/Tcformat.c
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/Format/Tcformat.c
parent7f1e21e6a1103fd4a488ddbe63571c6ffecb38ca (diff)
downloadVeraCrypt-5e96a5c44c3c78a901d77297517fa4842a297eb9.tar.gz
VeraCrypt-5e96a5c44c3c78a901d77297517fa4842a297eb9.zip
Windows: enhancements to the mechanism preserving file timestamps, especially for keyfiles.
Diffstat (limited to 'src/Format/Tcformat.c')
-rw-r--r--src/Format/Tcformat.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index dba64c20..013e27ca 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -3313,6 +3313,12 @@ BOOL IsSparseFile (HWND hwndDlg)
if (bPreserveTimestamp)
{
+ FILETIME ftLastAccessTime;
+ ftLastAccessTime.dwHighDateTime = 0xFFFFFFFF;
+ ftLastAccessTime.dwLowDateTime = 0xFFFFFFFF;
+
+ SetFileTime (hFile, NULL, &ftLastAccessTime, NULL);
+
if (GetFileTime (hFile, NULL, &ftLastAccessTime, NULL) == 0)
bTimeStampValid = FALSE;
else
@@ -3352,6 +3358,12 @@ BOOL GetFileVolSize (HWND hwndDlg, unsigned __int64 *size)
if (bPreserveTimestamp)
{
+ FILETIME ftLastAccessTime;
+ ftLastAccessTime.dwHighDateTime = 0xFFFFFFFF;
+ ftLastAccessTime.dwLowDateTime = 0xFFFFFFFF;
+
+ SetFileTime (hFile, NULL, &ftLastAccessTime, NULL);
+
if (GetFileTime (hFile, NULL, &ftLastAccessTime, NULL) == 0)
bTimeStampValid = FALSE;
else