mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:02:59 +00:00
[NTFS]
Always gather the size of the unnamed stream for directory display. This fixes file size display when there are several data streams available svn path=/trunk/; revision=68308
This commit is contained in:
parent
7c3f4c94a4
commit
296712e3fa
1 changed files with 31 additions and 6 deletions
|
@ -35,6 +35,31 @@
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* 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
|
static NTSTATUS
|
||||||
NtfsGetNameInformation(PDEVICE_EXTENSION DeviceExt,
|
NtfsGetNameInformation(PDEVICE_EXTENSION DeviceExt,
|
||||||
PFILE_RECORD_HEADER FileRecord,
|
PFILE_RECORD_HEADER FileRecord,
|
||||||
|
@ -109,8 +134,8 @@ NtfsGetDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
|
||||||
/* Convert file flags */
|
/* Convert file flags */
|
||||||
NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
|
NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
|
||||||
|
|
||||||
Info->EndOfFile.QuadPart = FileName->AllocatedSize;
|
Info->EndOfFile.QuadPart = NtfsGetFileSize(FileRecord, FileName);
|
||||||
Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize, DeviceExt->NtfsInfo.BytesPerCluster);
|
Info->AllocationSize.QuadPart = ROUND_UP(Info->EndOfFile.QuadPart, DeviceExt->NtfsInfo.BytesPerCluster);
|
||||||
|
|
||||||
Info->FileIndex = MFTIndex;
|
Info->FileIndex = MFTIndex;
|
||||||
|
|
||||||
|
@ -159,8 +184,8 @@ NtfsGetFullDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
|
||||||
/* Convert file flags */
|
/* Convert file flags */
|
||||||
NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
|
NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
|
||||||
|
|
||||||
Info->EndOfFile.QuadPart = FileName->AllocatedSize;
|
Info->EndOfFile.QuadPart = NtfsGetFileSize(FileRecord, FileName);
|
||||||
Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize, DeviceExt->NtfsInfo.BytesPerCluster);
|
Info->AllocationSize.QuadPart = ROUND_UP(Info->EndOfFile.QuadPart, DeviceExt->NtfsInfo.BytesPerCluster);
|
||||||
|
|
||||||
Info->FileIndex = MFTIndex;
|
Info->FileIndex = MFTIndex;
|
||||||
Info->EaSize = 0;
|
Info->EaSize = 0;
|
||||||
|
@ -224,8 +249,8 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
|
||||||
/* Convert file flags */
|
/* Convert file flags */
|
||||||
NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
|
NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
|
||||||
|
|
||||||
Info->EndOfFile.QuadPart = FileName->AllocatedSize;
|
Info->EndOfFile.QuadPart = NtfsGetFileSize(FileRecord, FileName);
|
||||||
Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize, DeviceExt->NtfsInfo.BytesPerCluster);
|
Info->AllocationSize.QuadPart = ROUND_UP(Info->EndOfFile.QuadPart, DeviceExt->NtfsInfo.BytesPerCluster);
|
||||||
|
|
||||||
Info->FileIndex = MFTIndex;
|
Info->FileIndex = MFTIndex;
|
||||||
Info->EaSize = 0;
|
Info->EaSize = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue