Bugfixing... Part 2/X:
- Please welcome yet another structure in our NTFS driver... The INDX buffer which is used for non resident index entries. Doc (incomplete) here: http://bos.asmhackers.net/docs/filesystems/ntfs/INDX.html
- Make use of it in NtfsFindMftRecord() to replace some totally obscure code.
- Add some asserts to verify we read somehow what we expect. One of the assert is not working properly... Hum! Need to find out why.

We don't go any farther so far. Good news though: a FIXME has been replaced by another FIXME.
NB: This would deserve being ported to FreeLDR to fix the same FIXME.

svn path=/trunk/; revision=64771
This commit is contained in:
Pierre Schweitzer 2014-10-16 21:37:27 +00:00
parent 08a4791b4a
commit 104149a180
2 changed files with 14 additions and 3 deletions

View file

@ -495,6 +495,7 @@ NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
PNTFS_ATTR_CONTEXT IndexBitmapCtx;
PNTFS_ATTR_CONTEXT IndexAllocationCtx;
PINDEX_ROOT_ATTRIBUTE IndexRoot;
PINDEX_BUFFER IndexBuffer;
ULONGLONG BitmapDataSize;
ULONGLONG IndexAllocationSize;
PCHAR BitmapData;
@ -626,9 +627,12 @@ NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
break;
}
/* FIXME */
IndexEntry = (PINDEX_ENTRY_ATTRIBUTE)(IndexRecord + 0x18 + *(USHORT *)(IndexRecord + 0x18));
IndexEntryEnd = (PINDEX_ENTRY_ATTRIBUTE)(IndexRecord + IndexBlockSize);
IndexBuffer = (PINDEX_BUFFER)IndexRecord;
ASSERT(IndexBuffer->Ntfs.Type == 'XDNI');
ASSERT(IndexBuffer->Header.AllocatedSize + 0x18 == IndexBlockSize);
IndexEntry = (PINDEX_ENTRY_ATTRIBUTE)(&IndexBuffer->Header + IndexBuffer->Header.FirstEntryOffset);
IndexEntryEnd = (PINDEX_ENTRY_ATTRIBUTE)(&IndexBuffer->Header + IndexBuffer->Header.TotalSizeOfEntries);
//ASSERT(IndexEntryEnd <= (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)IndexBuffer + IndexBlockSize)); FIXME: Why doesn't it work?
while (IndexEntry < IndexEntryEnd &&
!(IndexEntry->Flags & NTFS_INDEX_ENTRY_END))

View file

@ -329,6 +329,13 @@ typedef struct
INDEX_HEADER_ATTRIBUTE Header;
} INDEX_ROOT_ATTRIBUTE, *PINDEX_ROOT_ATTRIBUTE;
typedef struct
{
NTFS_RECORD_HEADER Ntfs;
ULONGLONG VCN;
INDEX_HEADER_ATTRIBUTE Header;
} INDEX_BUFFER, *PINDEX_BUFFER;
typedef struct
{
union