Author: pschweitzer
Date: Sat Jun 27 15:06:25 2015
New Revision: 68291
URL:
http://svn.reactos.org/svn/reactos?rev=68291&view=rev
Log:
[NTFS]
When dumping attributes, also dump attributes from the $ATTRIBUTE_LIST if present
Modified:
trunk/reactos/drivers/filesystems/ntfs/attrib.c
trunk/reactos/drivers/filesystems/ntfs/dirctl.c
trunk/reactos/drivers/filesystems/ntfs/fsctl.c
trunk/reactos/drivers/filesystems/ntfs/ntfs.h
Modified: trunk/reactos/drivers/filesystems/ntfs/attrib.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/a…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/attrib.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/attrib.c [iso-8859-1] Sat Jun 27 15:06:25 2015
@@ -184,7 +184,53 @@
static
VOID
-NtfsDumpAttribute(PNTFS_ATTR_RECORD Attribute)
+NtfsDumpAttribute(PDEVICE_EXTENSION Vcb, PNTFS_ATTR_RECORD Attribute);
+
+
+static
+VOID
+NtfsDumpAttributeListAttribute(PDEVICE_EXTENSION Vcb,
+ PNTFS_ATTR_RECORD Attribute)
+{
+ PNTFS_ATTR_CONTEXT ListContext;
+ PVOID ListBuffer;
+ ULONGLONG ListSize;
+
+ ListContext = PrepareAttributeContext(Attribute);
+
+ ListSize = AttributeDataLength(&ListContext->Record);
+ if (ListSize <= 0xFFFFFFFF)
+ ListBuffer = ExAllocatePoolWithTag(NonPagedPool, (ULONG)ListSize, TAG_NTFS);
+ else
+ ListBuffer = NULL;
+
+ if (!ListBuffer)
+ {
+ DPRINT("Failed to allocate memory: %x\n", (ULONG)ListSize);
+ return;
+ }
+
+ if (ReadAttribute(Vcb, ListContext, 0, ListBuffer, (ULONG)ListSize) == ListSize)
+ {
+ Attribute = (PNTFS_ATTR_RECORD)ListBuffer;
+ while (Attribute < (PNTFS_ATTR_RECORD)((PCHAR)ListBuffer + ListSize)
&&
+ Attribute->Type != AttributeEnd)
+ {
+ NtfsDumpAttribute(Vcb, Attribute);
+
+ Attribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)Attribute +
Attribute->Length);
+ }
+
+ ReleaseAttributeContext(ListContext);
+ ExFreePoolWithTag(ListBuffer, TAG_NTFS);
+ }
+}
+
+
+static
+VOID
+NtfsDumpAttribute(PDEVICE_EXTENSION Vcb,
+ PNTFS_ATTR_RECORD Attribute)
{
UNICODE_STRING Name;
@@ -202,7 +248,7 @@
break;
case AttributeAttributeList:
- DbgPrint(" $ATTRIBUTE_LIST ");
+ NtfsDumpAttributeListAttribute(Vcb, Attribute);
break;
case AttributeObjectId:
@@ -264,32 +310,36 @@
break;
}
- if (Attribute->NameLength != 0)
- {
- Name.Length = Attribute->NameLength * sizeof(WCHAR);
- Name.MaximumLength = Name.Length;
- Name.Buffer = (PWCHAR)((ULONG_PTR)Attribute + Attribute->NameOffset);
-
- DbgPrint("'%wZ' ", &Name);
- }
-
- DbgPrint("(%s)\n",
- Attribute->IsNonResident ? "non-resident" :
"resident");
-
- if (Attribute->IsNonResident)
- {
- FindRun(Attribute,0,&lcn, &runcount);
-
- DbgPrint(" AllocatedSize %I64u DataSize %I64u\n",
- Attribute->NonResident.AllocatedSize,
Attribute->NonResident.DataSize);
- DbgPrint(" logical clusters: %I64u - %I64u\n",
- lcn, lcn + runcount - 1);
- }
-}
-
-
-VOID
-NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord)
+ if (Attribute->Type != AttributeAttributeList)
+ {
+ if (Attribute->NameLength != 0)
+ {
+ Name.Length = Attribute->NameLength * sizeof(WCHAR);
+ Name.MaximumLength = Name.Length;
+ Name.Buffer = (PWCHAR)((ULONG_PTR)Attribute + Attribute->NameOffset);
+
+ DbgPrint("'%wZ' ", &Name);
+ }
+
+ DbgPrint("(%s)\n",
+ Attribute->IsNonResident ? "non-resident" :
"resident");
+
+ if (Attribute->IsNonResident)
+ {
+ FindRun(Attribute,0,&lcn, &runcount);
+
+ DbgPrint(" AllocatedSize %I64u DataSize %I64u\n",
+ Attribute->NonResident.AllocatedSize,
Attribute->NonResident.DataSize);
+ DbgPrint(" logical clusters: %I64u - %I64u\n",
+ lcn, lcn + runcount - 1);
+ }
+ }
+}
+
+
+VOID
+NtfsDumpFileAttributes(PDEVICE_EXTENSION Vcb,
+ PFILE_RECORD_HEADER FileRecord)
{
PNTFS_ATTR_RECORD Attribute;
@@ -297,7 +347,7 @@
while (Attribute < (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord +
FileRecord->BytesInUse) &&
Attribute->Type != AttributeEnd)
{
- NtfsDumpAttribute(Attribute);
+ NtfsDumpAttribute(Vcb, Attribute);
Attribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)Attribute + Attribute->Length);
}
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] Sat Jun 27 15:06:25 2015
@@ -51,7 +51,7 @@
if (FileName == NULL)
{
DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
- NtfsDumpFileAttributes(FileRecord);
+ NtfsDumpFileAttributes(DeviceExt, FileRecord);
return STATUS_OBJECT_NAME_NOT_FOUND;
}
@@ -85,7 +85,7 @@
if (FileName == NULL)
{
DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
- NtfsDumpFileAttributes(FileRecord);
+ NtfsDumpFileAttributes(DeviceExt, FileRecord);
return STATUS_OBJECT_NAME_NOT_FOUND;
}
@@ -135,7 +135,7 @@
if (FileName == NULL)
{
DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
- NtfsDumpFileAttributes(FileRecord);
+ NtfsDumpFileAttributes(DeviceExt, FileRecord);
return STATUS_OBJECT_NAME_NOT_FOUND;
}
@@ -186,7 +186,7 @@
if (FileName == NULL)
{
DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
- NtfsDumpFileAttributes(FileRecord);
+ NtfsDumpFileAttributes(DeviceExt, FileRecord);
return STATUS_OBJECT_NAME_NOT_FOUND;
}
ShortFileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_DOS);
Modified: trunk/reactos/drivers/filesystems/ntfs/fsctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/fsctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/fsctl.c [iso-8859-1] Sat Jun 27 15:06:25 2015
@@ -327,10 +327,10 @@
}
/* Enumerate attributes */
- NtfsDumpFileAttributes(DeviceExt->MasterFileTable);
+ NtfsDumpFileAttributes(DeviceExt, DeviceExt->MasterFileTable);
/* Enumerate attributes */
- NtfsDumpFileAttributes(VolumeRecord);
+ NtfsDumpFileAttributes(DeviceExt, VolumeRecord);
/* Get volume name */
Status = FindAttribute(DeviceExt, VolumeRecord, AttributeVolumeName, L"",
0, &AttrCtxt);
Modified: trunk/reactos/drivers/filesystems/ntfs/ntfs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/n…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Sat Jun 27 15:06:25 2015
@@ -486,7 +486,7 @@
ULONGLONG *DataRunLength);
VOID
-NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord);
+NtfsDumpFileAttributes(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord);
PSTANDARD_INFORMATION
GetStandardInformationFromRecord(PFILE_RECORD_HEADER FileRecord);
@@ -667,6 +667,9 @@
/* mft.c */
+PNTFS_ATTR_CONTEXT
+PrepareAttributeContext(PNTFS_ATTR_RECORD AttrRecord);
+
VOID
ReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context);