Author: pschweitzer
Date: Thu Oct 16 21:37:27 2014
New Revision: 64771

URL: http://svn.reactos.org/svn/reactos?rev=64771&view=rev
Log:
[NTFS]
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.

Modified:
    trunk/reactos/drivers/filesystems/ntfs/mft.c
    trunk/reactos/drivers/filesystems/ntfs/ntfs.h

Modified: trunk/reactos/drivers/filesystems/ntfs/mft.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/mft.c?rev=64771&r1=64770&r2=64771&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/mft.c        [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/mft.c        [iso-8859-1] Thu Oct 16 
21:37:27 2014
@@ -495,6 +495,7 @@
     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 @@
                     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))

Modified: trunk/reactos/drivers/filesystems/ntfs/ntfs.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/ntfs.h?rev=64771&r1=64770&r2=64771&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/ntfs.h       [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/ntfs.h       [iso-8859-1] Thu Oct 16 
21:37:27 2014
@@ -331,6 +331,13 @@
 
 typedef struct
 {
+    NTFS_RECORD_HEADER Ntfs;
+    ULONGLONG VCN;
+    INDEX_HEADER_ATTRIBUTE Header;
+} INDEX_BUFFER, *PINDEX_BUFFER;
+
+typedef struct
+{
     union
     {
         struct


Reply via email to