Author: hpoussin
Date: Sun Nov  2 20:18:34 2014
New Revision: 65196

URL: http://svn.reactos.org/svn/reactos?rev=65196&view=rev
Log:
[NTFS] Hack fix duplicate directory entries for files having a short name and a 
long name

Modified:
    trunk/reactos/drivers/filesystems/ntfs/dirctl.c

Modified: trunk/reactos/drivers/filesystems/ntfs/dirctl.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/dirctl.c?rev=65196&r1=65195&r2=65196&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/dirctl.c     [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/dirctl.c     [iso-8859-1] Sun Nov  2 
20:18:34 2014
@@ -310,7 +310,7 @@
     NTSTATUS Status = STATUS_SUCCESS;
     PFILE_RECORD_HEADER FileRecord;
     PNTFS_ATTR_CONTEXT DataContext;
-    ULONGLONG MFTRecord;
+    ULONGLONG MFTRecord, OldMFTRecord = 0;
     UNICODE_STRING Pattern;
 
     DPRINT1("NtfsQueryDirectory() called\n");
@@ -405,10 +405,21 @@
                                 &DataContext,
                                 &MFTRecord,
                                 Fcb->MFTIndex);
-      //DPRINT("Found %S, Status=%x, entry %x\n", TempFcb.ObjectName, Status, 
Ccb->Entry);
 
         if (NT_SUCCESS(Status))
         {
+            /* HACK: files with both a short name and a long name are present 
twice in the index.
+             * Ignore the second entry, if it is immediately following the 
first one.
+             */
+            if (MFTRecord == OldMFTRecord)
+            {
+                DPRINT("Ignoring duplicate MFT entry 0x%x\n", MFTRecord);
+                Ccb->Entry++;
+                ExFreePoolWithTag(FileRecord, TAG_NTFS);
+                continue;
+            }
+            OldMFTRecord = MFTRecord;
+
             switch (FileInformationClass)
             {
                 case FileNameInformation:


Reply via email to