Author: pschweitzer
Date: Tue Oct 14 18:41:38 2014
New Revision: 64742

URL: http://svn.reactos.org/svn/reactos?rev=64742&view=rev
Log:
[NTFS]
- Prepare (only prototype so far) NtfsFindMftRecord() for directory search & 
enumeration with WC.
- Modify CompareFileName() so that comparisons can be done with or without WC.
- Fix NtfsLookupFileAt() accordingly 

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

Modified: trunk/reactos/drivers/filesystems/ntfs/mft.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/mft.c?rev=64742&r1=64741&r2=64742&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/mft.c        [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/mft.c        [iso-8859-1] Tue Oct 14 
18:41:38 2014
@@ -462,7 +462,8 @@
 
 BOOLEAN
 CompareFileName(PUNICODE_STRING FileName,
-                PINDEX_ENTRY_ATTRIBUTE IndexEntry)
+                PINDEX_ENTRY_ATTRIBUTE IndexEntry,
+                BOOLEAN DirSearch)
 {
     UNICODE_STRING EntryName;
 
@@ -470,12 +471,24 @@
     EntryName.Length = 
     EntryName.MaximumLength = IndexEntry->FileName.NameLength;
 
-    return (RtlCompareUnicodeString(FileName, &EntryName, 
!!(IndexEntry->FileName.NameType != NTFS_FILE_NAME_POSIX)) == TRUE);
+    if (DirSearch)
+    {
+        return FsRtlIsNameInExpression(FileName, &EntryName, 
(IndexEntry->FileName.NameType != NTFS_FILE_NAME_POSIX), NULL);
+    }
+    else
+    {
+        return (RtlCompareUnicodeString(FileName, &EntryName, 
(IndexEntry->FileName.NameType != NTFS_FILE_NAME_POSIX)) == TRUE);
+    }
 }
 
 
 NTSTATUS
-NtfsFindMftRecord(PDEVICE_EXTENSION Vcb, ULONGLONG MFTIndex, PUNICODE_STRING 
FileName, ULONGLONG *OutMFTIndex)
+NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
+                  ULONGLONG MFTIndex,
+                  PUNICODE_STRING FileName,
+                  ULONG FirstEntry,
+                  BOOLEAN DirSearch,
+                  ULONGLONG *OutMFTIndex)
 {
     PFILE_RECORD_HEADER MftRecord;
     //ULONG Magic;
@@ -530,7 +543,7 @@
         while (IndexEntry < IndexEntryEnd &&
                !(IndexEntry->Flags & NTFS_INDEX_ENTRY_END))
         {
-            if (CompareFileName(FileName, IndexEntry))
+            if (CompareFileName(FileName, IndexEntry, DirSearch))
             {
                 *OutMFTIndex = IndexEntry->Data.Directory.IndexedFile;
                 ExFreePoolWithTag(IndexRecord, TAG_NTFS);
@@ -613,7 +626,7 @@
                 while (IndexEntry < IndexEntryEnd &&
                        !(IndexEntry->Flags & NTFS_INDEX_ENTRY_END))
                 {
-                    if (CompareFileName(FileName, IndexEntry))
+                    if (CompareFileName(FileName, IndexEntry, DirSearch))
                     {
                         DPRINT("File found\n");
                         *OutMFTIndex = IndexEntry->Data.Directory.IndexedFile;
@@ -663,7 +676,7 @@
     {
         DPRINT1("Lookup: %wZ\n", &Current);
 
-        Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, 
&CurrentMFTIndex);
+        Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, 0, FALSE, 
&CurrentMFTIndex);
         if (!NT_SUCCESS(Status))
         {
             return Status;


Reply via email to