[FASTFAT] When overwriting a file, also update its write time
authorPierre Schweitzer <pierre@reactos.org>
Sun, 7 Jan 2018 10:34:41 +0000 (11:34 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 7 Jan 2018 10:34:41 +0000 (11:34 +0100)
drivers/filesystems/fastfat/create.c

index f1b9b37..b9acc7f 100644 (file)
@@ -923,6 +923,8 @@ VfatCreateFile(
 
             if (!vfatFCBIsDirectory(pFcb))
             {
+                LARGE_INTEGER SystemTime;
+
                 if (RequestedDisposition == FILE_SUPERSEDE)
                 {
                     *pFcb->Attributes = Attributes;
@@ -932,6 +934,21 @@ VfatCreateFile(
                     *pFcb->Attributes |= Attributes;
                 }
                 *pFcb->Attributes |= FILE_ATTRIBUTE_ARCHIVE;
+
+                KeQuerySystemTime(&SystemTime);
+                if (vfatVolumeIsFatX(DeviceExt))
+                {
+                    FsdSystemTimeToDosDateTime(DeviceExt,
+                                               &SystemTime, &pFcb->entry.FatX.UpdateDate,
+                                               &pFcb->entry.FatX.UpdateTime);
+                }
+                else
+                {
+                    FsdSystemTimeToDosDateTime(DeviceExt,
+                                               &SystemTime, &pFcb->entry.Fat.UpdateDate,
+                                               &pFcb->entry.Fat.UpdateTime);
+                }
+
                 VfatUpdateEntry(pFcb, vfatVolumeIsFatX(DeviceExt));
             }