From: Hervé Poussineau Date: Sun, 2 Nov 2014 20:18:34 +0000 (+0000) Subject: [NTFS] Hack fix duplicate directory entries for files having a short name and a long... X-Git-Tag: backups/tcpip_revolution@71025~115 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=6a520d8fbe2737ee0974f20257ebbf29724d23e4 [NTFS] Hack fix duplicate directory entries for files having a short name and a long name svn path=/trunk/; revision=65196 --- diff --git a/reactos/drivers/filesystems/ntfs/dirctl.c b/reactos/drivers/filesystems/ntfs/dirctl.c index 6a207e12fbf..ba18c0e68e4 100644 --- a/reactos/drivers/filesystems/ntfs/dirctl.c +++ b/reactos/drivers/filesystems/ntfs/dirctl.c @@ -310,7 +310,7 @@ NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext) 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 @@ NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext) &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: