From e5057ddea78e417da28c1165a4e6b0bcc6846ade Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 17 Jan 2003 18:51:13 +0000 Subject: [PATCH] Dump some file attributes (file name, volume name, etc.) Fixed infinite loop in a 'dir' command. svn path=/trunk/; revision=4024 --- reactos/drivers/fs/ntfs/attrib.c | 67 ++++++++++++++++++++++++++++---- reactos/drivers/fs/ntfs/dirctl.c | 9 +++-- 2 files changed, 64 insertions(+), 12 deletions(-) diff --git a/reactos/drivers/fs/ntfs/attrib.c b/reactos/drivers/fs/ntfs/attrib.c index 22ce811825f..1baa6050a24 100644 --- a/reactos/drivers/fs/ntfs/attrib.c +++ b/reactos/drivers/fs/ntfs/attrib.c @@ -1,6 +1,6 @@ /* * ReactOS kernel - * Copyright (C) 2002 ReactOS Team + * Copyright (C) 2002,2003 ReactOS Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,11 +16,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: attrib.c,v 1.1 2002/07/15 15:37:33 ekohl Exp $ +/* $Id: attrib.c,v 1.2 2003/01/17 18:51:13 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/ntfs/attrib.c + * FILE: drivers/fs/ntfs/attrib.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Eric Kohl */ @@ -29,7 +29,7 @@ #include -//#define NDEBUG +#define NDEBUG #include #include "ntfs.h" @@ -37,6 +37,57 @@ /* FUNCTIONS ****************************************************************/ +VOID +NtfsDumpFileNameAttribute(PATTRIBUTE Attribute) +{ + PRESIDENT_ATTRIBUTE ResAttr; + PFILENAME_ATTRIBUTE FileNameAttr; + + DbgPrint(" $FILE_NAME "); + + ResAttr = (PRESIDENT_ATTRIBUTE)Attribute; +// DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset); + + FileNameAttr = (PFILENAME_ATTRIBUTE)((PVOID)ResAttr + ResAttr->ValueOffset); + DbgPrint(" '%.*S' ", FileNameAttr->NameLength, FileNameAttr->Name); +} + + +VOID +NtfsDumpVolumeNameAttribute(PATTRIBUTE Attribute) +{ + PRESIDENT_ATTRIBUTE ResAttr; + PWCHAR VolumeName; + + DbgPrint(" $VOLUME_NAME "); + + ResAttr = (PRESIDENT_ATTRIBUTE)Attribute; +// DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset); + + VolumeName = (PWCHAR)((PVOID)ResAttr + ResAttr->ValueOffset); + DbgPrint(" '%.*S' ", ResAttr->ValueLength/2, VolumeName); +} + + +VOID +NtfsDumpVolumeInformationAttribute(PATTRIBUTE Attribute) +{ + PRESIDENT_ATTRIBUTE ResAttr; + PVOLINFO_ATTRIBUTE VolInfoAttr; + + DbgPrint(" $VOLUME_INFORMATION "); + + ResAttr = (PRESIDENT_ATTRIBUTE)Attribute; +// DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset); + + VolInfoAttr = (PVOLINFO_ATTRIBUTE)((PVOID)ResAttr + ResAttr->ValueOffset); + DbgPrint(" NTFS Version %u.%u Flags 0x%04hx ", + VolInfoAttr->MajorVersion, + VolInfoAttr->MinorVersion, + VolInfoAttr->Flags); +} + + VOID NtfsDumpAttribute(PATTRIBUTE Attribute) { @@ -59,7 +110,7 @@ NtfsDumpAttribute(PATTRIBUTE Attribute) break; case AttributeFileName: - DbgPrint(" $FILE_NAME "); + NtfsDumpFileNameAttribute(Attribute); break; case AttributeObjectId: @@ -71,11 +122,11 @@ NtfsDumpAttribute(PATTRIBUTE Attribute) break; case AttributeVolumeName: - DbgPrint(" $VOLUME_NAME "); + NtfsDumpVolumeNameAttribute(Attribute); break; case AttributeVolumeInformation: - DbgPrint(" $VOLUME_INFORMATION "); + NtfsDumpVolumeInformationAttribute(Attribute); break; case AttributeData: @@ -130,7 +181,7 @@ NtfsDumpAttribute(PATTRIBUTE Attribute) } DbgPrint("(%s)\n", - Attribute->Nonresident ? "nonresident" : "resident"); + Attribute->Nonresident ? "non-resident" : "resident"); if (Attribute->Nonresident != 0) { diff --git a/reactos/drivers/fs/ntfs/dirctl.c b/reactos/drivers/fs/ntfs/dirctl.c index ab15cde4120..19ab72758c1 100644 --- a/reactos/drivers/fs/ntfs/dirctl.c +++ b/reactos/drivers/fs/ntfs/dirctl.c @@ -1,6 +1,6 @@ /* * ReactOS kernel - * Copyright (C) 2002 ReactOS Team + * Copyright (C) 2002,2003 ReactOS Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,11 +16,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: dirctl.c,v 1.3 2002/09/08 10:22:11 chorns Exp $ +/* $Id: dirctl.c,v 1.4 2003/01/17 18:51:13 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/ntfs/dirctl.c + * FILE: drivers/fs/ntfs/dirctl.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Eric Kohl */ @@ -664,7 +664,8 @@ NtfsQueryDirectory(PDEVICE_OBJECT DeviceObject, Status = STATUS_SUCCESS; } - return(Status); +// return(Status); + return(STATUS_NO_MORE_FILES); }