Attribute exception list

Mar 5, 2010 at 6:30 PM

On my W7 VHD's I was getting an exception when enumerating the attributes of a file. I found that in File.cs there is a comparision in LoadAttributes():

if (lastAttr == null || lastType != record.Type || lastName != record.Name)

This caused some name attributes to be treated as extents.  Later in the code when the extents are attempted to be read in NtfsAttributeBuffer.cs / GetExtent it attempts to cast the resident attribute to a (NonResidentAttributeRecord)extents[i] and (since the cast is invalid) throws an exception.

I suggest changing it to:

if (lastAttr == null || lastType != record.Type || lastName != record.Name || record.Type == AttributeType.FileName)

Filename attributes are always resident, they will never be in an extent.


Mar 5, 2010 at 11:12 PM

Thanks Bill,

The latest changes in Mercurial have changed the approach used - this logic is now used to determine when to start a new attribute:

if (record.StartVcn == 0)

I'll do another update to the 0.8 preview release in the next couple of days with this and other fixes in it.



Mar 5, 2010 at 11:28 PM

Great, I look forward to the refresh!