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>
38 /* FUNCTIONS ****************************************************************/
41 NtfsDumpFileNameAttribute(PATTRIBUTE Attribute)
43 PRESIDENT_ATTRIBUTE ResAttr;
44 PFILENAME_ATTRIBUTE FileNameAttr;
46 DbgPrint(" $FILE_NAME ");
48 ResAttr = (PRESIDENT_ATTRIBUTE)Attribute;
49 // DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset);
51 FileNameAttr = (PFILENAME_ATTRIBUTE)((PVOID)ResAttr + ResAttr->ValueOffset);
52 DbgPrint(" '%.*S' ", FileNameAttr->NameLength, FileNameAttr->Name);
57 NtfsDumpVolumeNameAttribute(PATTRIBUTE Attribute)
59 PRESIDENT_ATTRIBUTE ResAttr;
62 DbgPrint(" $VOLUME_NAME ");
64 ResAttr = (PRESIDENT_ATTRIBUTE)Attribute;
65 // DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset);
67 VolumeName = (PWCHAR)((PVOID)ResAttr + ResAttr->ValueOffset);
68 DbgPrint(" '%.*S' ", ResAttr->ValueLength/2, VolumeName);
73 NtfsDumpVolumeInformationAttribute(PATTRIBUTE Attribute)
75 PRESIDENT_ATTRIBUTE ResAttr;
76 PVOLINFO_ATTRIBUTE VolInfoAttr;
78 DbgPrint(" $VOLUME_INFORMATION ");
80 ResAttr = (PRESIDENT_ATTRIBUTE)Attribute;
81 // DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset);
83 VolInfoAttr = (PVOLINFO_ATTRIBUTE)((PVOID)ResAttr + ResAttr->ValueOffset);
84 DbgPrint(" NTFS Version %u.%u Flags 0x%04hx ",
85 VolInfoAttr->MajorVersion,
86 VolInfoAttr->MinorVersion,
92 NtfsDumpAttribute(PATTRIBUTE Attribute)
94 PNONRESIDENT_ATTRIBUTE NresAttr;
95 PRESIDENT_ATTRIBUTE ResAttr;
102 switch (Attribute->AttributeType)
104 case AttributeStandardInformation:
105 DbgPrint(" $STANDARD_INFORMATION ");
108 case AttributeAttributeList:
109 DbgPrint(" $ATTRIBUTE_LIST ");
112 case AttributeFileName:
113 NtfsDumpFileNameAttribute(Attribute);
116 case AttributeObjectId:
117 DbgPrint(" $OBJECT_ID ");
120 case AttributeSecurityDescriptor:
121 DbgPrint(" $SECURITY_DESCRIPTOR ");
124 case AttributeVolumeName:
125 NtfsDumpVolumeNameAttribute(Attribute);
128 case AttributeVolumeInformation:
129 NtfsDumpVolumeInformationAttribute(Attribute);
136 case AttributeIndexRoot:
137 DbgPrint(" $INDEX_ROOT ");
140 case AttributeIndexAllocation:
141 DbgPrint(" $INDEX_ALLOCATION ");
144 case AttributeBitmap:
145 DbgPrint(" $BITMAP ");
148 case AttributeReparsePoint:
149 DbgPrint(" $REPARSE_POINT ");
152 case AttributeEAInformation:
153 DbgPrint(" $EA_INFORMATION ");
160 case AttributePropertySet:
161 DbgPrint(" $PROPERTY_SET ");
164 case AttributeLoggedUtilityStream:
165 DbgPrint(" $LOGGED_UTILITY_STREAM ");
169 DbgPrint(" Attribute %lx ",
170 Attribute->AttributeType);
174 if (Attribute->NameLength != 0)
176 Name.Length = Attribute->NameLength * sizeof(WCHAR);
177 Name.MaximumLength = Name.Length;
178 Name.Buffer = (PWCHAR)((ULONG)Attribute + Attribute->NameOffset);
180 DbgPrint("'%wZ' ", &Name);
184 Attribute->Nonresident ? "non-resident" : "resident");
186 if (Attribute->Nonresident != 0)
188 NresAttr = (PNONRESIDENT_ATTRIBUTE)Attribute;
189 Ptr = (PUCHAR)((ULONG)NresAttr + NresAttr->RunArrayOffset);
194 switch (RunHeader & 0x0F)
197 RunLength = (ULONG)*Ptr++;
201 RunLength = *((PUSHORT)Ptr);
207 RunLength += *Ptr++ << 8;
208 RunLength += *Ptr++ << 16;
212 RunLength = *((PULONG)Ptr);
217 DbgPrint("RunLength size of %hu not implemented!\n", RunHeader & 0x0F);
221 switch (RunHeader >> 4)
224 RunStart = (ULONG)*Ptr;
229 RunStart = *((PUSHORT)Ptr);
235 RunStart += *Ptr++ << 8;
236 RunStart += *Ptr++ << 16;
240 RunStart = *((PULONG)Ptr);
245 DbgPrint("RunStart size of %hu not implemented!\n", RunHeader >> 4);
249 DbgPrint(" AllocatedSize %I64d DataSize %I64d\n", NresAttr->AllocatedSize, NresAttr->DataSize);
250 // DbgPrint(" Run: Header %hx Start %lu Length %lu\n", RunHeader, RunStart, RunLength);
253 DbgPrint(" logical sector %lu (0x%lx)\n", RunStart, RunStart);
257 DbgPrint(" logical sectors %lu-%lu (0x%lx-0x%lx)\n",
258 RunStart, RunStart + RunLength - 1,
259 RunStart, RunStart + RunLength - 1);