[ros-diffs] [pschweitzer] 50995: [FASTFAT] Do not set file attributes in case they are set to 0 or -1

pschweitzer at svn.reactos.org pschweitzer at svn.reactos.org
Mon Mar 7 20:28:43 UTC 2011


Author: pschweitzer
Date: Mon Mar  7 20:28:42 2011
New Revision: 50995

URL: http://svn.reactos.org/svn/reactos?rev=50995&view=rev
Log:
[FASTFAT]
Do not set file attributes in case they are set to 0 or -1

Modified:
    trunk/reactos/drivers/filesystems/fastfat/finfo.c

Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/finfo.c?rev=50995&r1=50994&r2=50995&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Mon Mar  7 20:28:42 2011
@@ -156,43 +156,68 @@
 
   if (FCB->Flags & FCB_IS_FATX_ENTRY)
   {
-    FsdSystemTimeToDosDateTime(DeviceExt,
-                             &BasicInfo->CreationTime,
-                             &FCB->entry.FatX.CreationDate,
-                             &FCB->entry.FatX.CreationTime);
-    FsdSystemTimeToDosDateTime(DeviceExt,
-                             &BasicInfo->LastAccessTime,
-                             &FCB->entry.FatX.AccessDate,
-                             &FCB->entry.FatX.AccessTime);
-    FsdSystemTimeToDosDateTime(DeviceExt,
-                             &BasicInfo->LastWriteTime,
-                             &FCB->entry.FatX.UpdateDate,
-                             &FCB->entry.FatX.UpdateTime);
+    if (BasicInfo->CreationTime.QuadPart != 0 && BasicInfo->CreationTime.QuadPart != -1)
+    {
+      FsdSystemTimeToDosDateTime(DeviceExt,
+                                 &BasicInfo->CreationTime,
+                                 &FCB->entry.FatX.CreationDate,
+                                 &FCB->entry.FatX.CreationTime);
+    }
+
+    if (BasicInfo->LastAccessTime.QuadPart != 0 && BasicInfo->LastAccessTime.QuadPart != -1)
+    {
+      FsdSystemTimeToDosDateTime(DeviceExt,
+                                 &BasicInfo->LastAccessTime,
+                                 &FCB->entry.FatX.AccessDate,
+                                 &FCB->entry.FatX.AccessTime);
+    }
+
+    if (BasicInfo->LastWriteTime.QuadPart != 0 && BasicInfo->LastWriteTime.QuadPart != -1)
+    {
+      FsdSystemTimeToDosDateTime(DeviceExt,
+                                 &BasicInfo->LastWriteTime,
+                                 &FCB->entry.FatX.UpdateDate,
+                                 &FCB->entry.FatX.UpdateTime);
+    }
   }
   else
   {
-    FsdSystemTimeToDosDateTime(DeviceExt,
-                             &BasicInfo->CreationTime,
-                             &FCB->entry.Fat.CreationDate,
-                             &FCB->entry.Fat.CreationTime);
-    FsdSystemTimeToDosDateTime(DeviceExt,
-                             &BasicInfo->LastAccessTime,
-                             &FCB->entry.Fat.AccessDate,
-                             NULL);
-    FsdSystemTimeToDosDateTime(DeviceExt,
-                             &BasicInfo->LastWriteTime,
-                             &FCB->entry.Fat.UpdateDate,
-                             &FCB->entry.Fat.UpdateTime);
-  }
-
-  *FCB->Attributes = (unsigned char)((*FCB->Attributes &
-                       (FILE_ATTRIBUTE_DIRECTORY | 0x48)) |
-                      (BasicInfo->FileAttributes &
-                       (FILE_ATTRIBUTE_ARCHIVE |
-                        FILE_ATTRIBUTE_SYSTEM |
-                        FILE_ATTRIBUTE_HIDDEN |
-                        FILE_ATTRIBUTE_READONLY)));
-  DPRINT("Setting attributes 0x%02x\n", *FCB->Attributes);
+    if (BasicInfo->CreationTime.QuadPart != 0 && BasicInfo->CreationTime.QuadPart != -1)
+    {
+      FsdSystemTimeToDosDateTime(DeviceExt,
+                                 &BasicInfo->CreationTime,
+                                 &FCB->entry.Fat.CreationDate,
+                                 &FCB->entry.Fat.CreationTime);
+    }
+
+    if (BasicInfo->LastAccessTime.QuadPart != 0 && BasicInfo->LastAccessTime.QuadPart != -1)
+    {
+      FsdSystemTimeToDosDateTime(DeviceExt,
+                                 &BasicInfo->LastAccessTime,
+                                 &FCB->entry.Fat.AccessDate,
+                                 NULL);
+    }
+
+    if (BasicInfo->LastWriteTime.QuadPart != 0 && BasicInfo->LastWriteTime.QuadPart != -1)
+    {
+      FsdSystemTimeToDosDateTime(DeviceExt,
+                                 &BasicInfo->LastWriteTime,
+                                 &FCB->entry.Fat.UpdateDate,
+                                 &FCB->entry.Fat.UpdateTime);
+    }
+  }
+
+  if (BasicInfo->FileAttributes)
+  {
+    *FCB->Attributes = (unsigned char)((*FCB->Attributes &
+                        (FILE_ATTRIBUTE_DIRECTORY | 0x48)) |
+                        (BasicInfo->FileAttributes &
+                         (FILE_ATTRIBUTE_ARCHIVE |
+                          FILE_ATTRIBUTE_SYSTEM |
+                          FILE_ATTRIBUTE_HIDDEN |
+                          FILE_ATTRIBUTE_READONLY)));
+    DPRINT("Setting attributes 0x%02x\n", *FCB->Attributes);
+  }
 
   VfatUpdateEntry(FCB);
 




More information about the Ros-diffs mailing list