3 * Copyright (C) 2002,2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * FILE: drivers/fs/ntfs/attrib.c
24 * PURPOSE: NTFS filesystem driver
25 * PROGRAMMER: Eric Kohl
28 /* INCLUDES *****************************************************************/
30 #include <ddk/ntddk.h>
40 /* FUNCTIONS ****************************************************************/
43 NtfsDumpFileNameAttribute(PATTRIBUTE Attribute)
45 PRESIDENT_ATTRIBUTE ResAttr;
46 PFILENAME_ATTRIBUTE FileNameAttr;
48 DbgPrint(" $FILE_NAME ");
50 ResAttr = (PRESIDENT_ATTRIBUTE)Attribute;
51 // DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset);
53 FileNameAttr = (PFILENAME_ATTRIBUTE)((PVOID)ResAttr + ResAttr->ValueOffset);
54 DbgPrint(" '%.*S' ", FileNameAttr->NameLength, FileNameAttr->Name);
59 NtfsDumpVolumeNameAttribute(PATTRIBUTE Attribute)
61 PRESIDENT_ATTRIBUTE ResAttr;
64 DbgPrint(" $VOLUME_NAME ");
66 ResAttr = (PRESIDENT_ATTRIBUTE)Attribute;
67 // DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset);
69 VolumeName = (PWCHAR)((PVOID)ResAttr + ResAttr->ValueOffset);
70 DbgPrint(" '%.*S' ", ResAttr->ValueLength/2, VolumeName);
75 NtfsDumpVolumeInformationAttribute(PATTRIBUTE Attribute)
77 PRESIDENT_ATTRIBUTE ResAttr;
78 PVOLINFO_ATTRIBUTE VolInfoAttr;
80 DbgPrint(" $VOLUME_INFORMATION ");
82 ResAttr = (PRESIDENT_ATTRIBUTE)Attribute;
83 // DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset);
85 VolInfoAttr = (PVOLINFO_ATTRIBUTE)((PVOID)ResAttr + ResAttr->ValueOffset);
86 DbgPrint(" NTFS Version %u.%u Flags 0x%04hx ",
87 VolInfoAttr->MajorVersion,
88 VolInfoAttr->MinorVersion,
94 NtfsDumpAttribute(PATTRIBUTE Attribute)
96 PNONRESIDENT_ATTRIBUTE NresAttr;
97 PRESIDENT_ATTRIBUTE ResAttr;
104 switch (Attribute->AttributeType)
106 case AttributeStandardInformation:
107 DbgPrint(" $STANDARD_INFORMATION ");
110 case AttributeAttributeList:
111 DbgPrint(" $ATTRIBUTE_LIST ");
114 case AttributeFileName:
115 NtfsDumpFileNameAttribute(Attribute);
118 case AttributeObjectId:
119 DbgPrint(" $OBJECT_ID ");
122 case AttributeSecurityDescriptor:
123 DbgPrint(" $SECURITY_DESCRIPTOR ");
126 case AttributeVolumeName:
127 NtfsDumpVolumeNameAttribute(Attribute);
130 case AttributeVolumeInformation:
131 NtfsDumpVolumeInformationAttribute(Attribute);
138 case AttributeIndexRoot:
139 DbgPrint(" $INDEX_ROOT ");
142 case AttributeIndexAllocation:
143 DbgPrint(" $INDEX_ALLOCATION ");
146 case AttributeBitmap:
147 DbgPrint(" $BITMAP ");
150 case AttributeReparsePoint:
151 DbgPrint(" $REPARSE_POINT ");
154 case AttributeEAInformation:
155 DbgPrint(" $EA_INFORMATION ");
162 case AttributePropertySet:
163 DbgPrint(" $PROPERTY_SET ");
166 case AttributeLoggedUtilityStream:
167 DbgPrint(" $LOGGED_UTILITY_STREAM ");
171 DbgPrint(" Attribute %lx ",
172 Attribute->AttributeType);
176 if (Attribute->NameLength != 0)
178 Name.Length = Attribute->NameLength * sizeof(WCHAR);
179 Name.MaximumLength = Name.Length;
180 Name.Buffer = (PWCHAR)((ULONG)Attribute + Attribute->NameOffset);
182 DbgPrint("'%wZ' ", &Name);
186 Attribute->Nonresident ? "non-resident" : "resident");
188 if (Attribute->Nonresident != 0)
190 NresAttr = (PNONRESIDENT_ATTRIBUTE)Attribute;
191 Ptr = (PUCHAR)((ULONG)NresAttr + NresAttr->RunArrayOffset);
196 switch (RunHeader & 0x0F)
199 RunLength = (ULONG)*Ptr++;
203 RunLength = *((PUSHORT)Ptr);
209 RunLength += *Ptr++ << 8;
210 RunLength += *Ptr++ << 16;
214 RunLength = *((PULONG)Ptr);
219 DbgPrint("RunLength size of %hu not implemented!\n", RunHeader & 0x0F);
223 switch (RunHeader >> 4)
226 RunStart = (ULONG)*Ptr;
231 RunStart = *((PUSHORT)Ptr);
237 RunStart += *Ptr++ << 8;
238 RunStart += *Ptr++ << 16;
242 RunStart = *((PULONG)Ptr);
247 DbgPrint("RunStart size of %hu not implemented!\n", RunHeader >> 4);
251 DbgPrint(" AllocatedSize %I64d DataSize %I64d\n", NresAttr->AllocatedSize, NresAttr->DataSize);
252 // DbgPrint(" Run: Header %hx Start %lu Length %lu\n", RunHeader, RunStart, RunLength);
255 DbgPrint(" logical sector %lu (0x%lx)\n", RunStart, RunStart);
259 DbgPrint(" logical sectors %lu-%lu (0x%lx-0x%lx)\n",
260 RunStart, RunStart + RunLength - 1,
261 RunStart, RunStart + RunLength - 1);