Author: pschweitzer
Date: Sun Jun 28 20:55:29 2015
New Revision: 68308
URL:
http://svn.reactos.org/svn/reactos?rev=68308&view=rev
Log:
[NTFS]
Always gather the size of the unnamed stream for directory display.
This fixes file size display when there are several data streams available
Modified:
trunk/reactos/drivers/filesystems/ntfs/dirctl.c
Modified: trunk/reactos/drivers/filesystems/ntfs/dirctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/d…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] Sun Jun 28 20:55:29 2015
@@ -35,6 +35,31 @@
/* FUNCTIONS ****************************************************************/
+static ULONGLONG
+NtfsGetFileSize(PFILE_RECORD_HEADER FileRecord,
+ PFILENAME_ATTRIBUTE FileName)
+{
+ ULONGLONG Size;
+ PNTFS_ATTR_RECORD Attribute;
+
+ Size = FileName->AllocatedSize;
+ Attribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord +
FileRecord->AttributeOffset);
+ while (Attribute < (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord +
FileRecord->BytesInUse) &&
+ Attribute->Type != AttributeEnd)
+ {
+ if (Attribute->Type == AttributeData && Attribute->NameLength ==
0)
+ {
+ Size = AttributeDataLength(Attribute);
+ break;
+ }
+
+ Attribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)Attribute + Attribute->Length);
+ }
+
+ return Size;
+}
+
+
static NTSTATUS
NtfsGetNameInformation(PDEVICE_EXTENSION DeviceExt,
PFILE_RECORD_HEADER FileRecord,
@@ -109,8 +134,8 @@
/* Convert file flags */
NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute,
&Info->FileAttributes);
- Info->EndOfFile.QuadPart = FileName->AllocatedSize;
- Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize,
DeviceExt->NtfsInfo.BytesPerCluster);
+ Info->EndOfFile.QuadPart = NtfsGetFileSize(FileRecord, FileName);
+ Info->AllocationSize.QuadPart = ROUND_UP(Info->EndOfFile.QuadPart,
DeviceExt->NtfsInfo.BytesPerCluster);
Info->FileIndex = MFTIndex;
@@ -159,8 +184,8 @@
/* Convert file flags */
NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute,
&Info->FileAttributes);
- Info->EndOfFile.QuadPart = FileName->AllocatedSize;
- Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize,
DeviceExt->NtfsInfo.BytesPerCluster);
+ Info->EndOfFile.QuadPart = NtfsGetFileSize(FileRecord, FileName);
+ Info->AllocationSize.QuadPart = ROUND_UP(Info->EndOfFile.QuadPart,
DeviceExt->NtfsInfo.BytesPerCluster);
Info->FileIndex = MFTIndex;
Info->EaSize = 0;
@@ -224,8 +249,8 @@
/* Convert file flags */
NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute,
&Info->FileAttributes);
- Info->EndOfFile.QuadPart = FileName->AllocatedSize;
- Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize,
DeviceExt->NtfsInfo.BytesPerCluster);
+ Info->EndOfFile.QuadPart = NtfsGetFileSize(FileRecord, FileName);
+ Info->AllocationSize.QuadPart = ROUND_UP(Info->EndOfFile.QuadPart,
DeviceExt->NtfsInfo.BytesPerCluster);
Info->FileIndex = MFTIndex;
Info->EaSize = 0;