Dump some file attributes (file name, volume name, etc.)

Fixed infinite loop in a 'dir' command.

svn path=/trunk/; revision=4024
This commit is contained in:
Eric Kohl 2003-01-17 18:51:13 +00:00
parent 08a01c4da8
commit e5057ddea7
2 changed files with 64 additions and 12 deletions

View file

@ -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 <ddk/ntddk.h>
//#define NDEBUG
#define NDEBUG
#include <debug.h>
#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)
{

View file

@ -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);
}