[NTFS]
authorPierre Schweitzer <pierre@reactos.org>
Thu, 8 Jan 2015 20:28:25 +0000 (20:28 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Thu, 8 Jan 2015 20:28:25 +0000 (20:28 +0000)
Also retrieve $STANDARD_INFORMATION attribute on directory enumeration to get the right file attributes.
This fixes improper display in cmd & in explorer due to missing file attributes flags

svn path=/trunk/; revision=66007

reactos/drivers/filesystems/ntfs/dirctl.c

index e4ee862..3ff792b 100644 (file)
@@ -162,12 +162,16 @@ NtfsGetDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
 {
     ULONG Length;
     PFILENAME_ATTRIBUTE FileName;
+    PSTANDARD_INFORMATION StdInfo;
 
     DPRINT("NtfsGetDirectoryInformation() called\n");
 
     FileName = GetBestFileNameFromRecord(FileRecord);
     ASSERT(FileName != NULL);
 
+    StdInfo = GetStandardInformationFromRecord(FileRecord);
+    ASSERT(StdInfo != NULL);
+
     Length = FileName->NameLength * sizeof (WCHAR);
     if ((sizeof(FILE_DIRECTORY_INFORMATION) + Length) > BufferLength)
         return(STATUS_BUFFER_OVERFLOW);
@@ -183,7 +187,7 @@ NtfsGetDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
     Info->ChangeTime.QuadPart = FileName->ChangeTime;
 
     /* Convert file flags */
-    NtfsFileFlagsToAttributes(FileName->FileAttributes, &Info->FileAttributes);
+    NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
 
     Info->EndOfFile.QuadPart = FileName->AllocatedSize;
     Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize, DeviceExt->NtfsInfo.BytesPerCluster);
@@ -204,12 +208,16 @@ NtfsGetFullDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
 {
     ULONG Length;
     PFILENAME_ATTRIBUTE FileName;
+    PSTANDARD_INFORMATION StdInfo;
 
     DPRINT("NtfsGetFullDirectoryInformation() called\n");
 
     FileName = GetBestFileNameFromRecord(FileRecord);
     ASSERT(FileName != NULL);
 
+    StdInfo = GetStandardInformationFromRecord(FileRecord);
+    ASSERT(StdInfo != NULL);
+
     Length = FileName->NameLength * sizeof (WCHAR);
     if ((sizeof(FILE_FULL_DIRECTORY_INFORMATION) + Length) > BufferLength)
         return(STATUS_BUFFER_OVERFLOW);
@@ -225,7 +233,7 @@ NtfsGetFullDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
     Info->ChangeTime.QuadPart = FileName->ChangeTime;
 
     /* Convert file flags */
-    NtfsFileFlagsToAttributes(FileName->FileAttributes, &Info->FileAttributes);
+    NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
 
     Info->EndOfFile.QuadPart = FileName->AllocatedSize;
     Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize, DeviceExt->NtfsInfo.BytesPerCluster);
@@ -247,6 +255,7 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
 {
     ULONG Length;
     PFILENAME_ATTRIBUTE FileName, ShortFileName;
+    PSTANDARD_INFORMATION StdInfo;
 
     DPRINT("NtfsGetBothDirectoryInformation() called\n");
 
@@ -254,6 +263,9 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
     ASSERT(FileName != NULL);
     ShortFileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_DOS);
 
+    StdInfo = GetStandardInformationFromRecord(FileRecord);
+    ASSERT(StdInfo != NULL);
+
     Length = FileName->NameLength * sizeof (WCHAR);
     if ((sizeof(FILE_BOTH_DIR_INFORMATION) + Length) > BufferLength)
         return(STATUS_BUFFER_OVERFLOW);
@@ -282,7 +294,7 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
     Info->ChangeTime.QuadPart = FileName->ChangeTime;
 
     /* Convert file flags */
-    NtfsFileFlagsToAttributes(FileName->FileAttributes, &Info->FileAttributes);
+    NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
 
     Info->EndOfFile.QuadPart = FileName->AllocatedSize;
     Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize, DeviceExt->NtfsInfo.BytesPerCluster);