Author: pschweitzer
Date: Tue Oct 14 20:34:38 2014
New Revision: 64744
URL:
http://svn.reactos.org/svn/reactos?rev=64744&view=rev
Log:
[NTFS]
Also return the index of the entry which was found
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/m…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/mft.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/mft.c [iso-8859-1] Tue Oct 14 20:34:38 2014
@@ -486,7 +486,7 @@
NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
ULONGLONG MFTIndex,
PUNICODE_STRING FileName,
- ULONG FirstEntry,
+ PULONG FirstEntry,
BOOLEAN DirSearch,
ULONGLONG *OutMFTIndex,
PWSTR OutName)
@@ -545,9 +545,10 @@
while (IndexEntry < IndexEntryEnd &&
!(IndexEntry->Flags & NTFS_INDEX_ENTRY_END))
{
- if (CurrentEntry >= FirstEntry && CompareFileName(FileName,
IndexEntry, DirSearch))
+ if (CurrentEntry >= *FirstEntry && CompareFileName(FileName,
IndexEntry, DirSearch))
{
*OutMFTIndex = IndexEntry->Data.Directory.IndexedFile;
+ *FirstEntry = CurrentEntry;
RtlCopyMemory(OutName, IndexEntry->FileName.Name,
IndexEntry->FileName.NameLength);
OutName[IndexEntry->FileName.NameLength / sizeof(WCHAR)] =
UNICODE_NULL;
ExFreePoolWithTag(IndexRecord, TAG_NTFS);
@@ -632,10 +633,11 @@
while (IndexEntry < IndexEntryEnd &&
!(IndexEntry->Flags & NTFS_INDEX_ENTRY_END))
{
- if (CurrentEntry >= FirstEntry &&
CompareFileName(FileName, IndexEntry, DirSearch))
+ if (CurrentEntry >= *FirstEntry &&
CompareFileName(FileName, IndexEntry, DirSearch))
{
DPRINT("File found\n");
*OutMFTIndex = IndexEntry->Data.Directory.IndexedFile;
+ *FirstEntry = CurrentEntry;
RtlCopyMemory(OutName, IndexEntry->FileName.Name,
IndexEntry->FileName.NameLength);
OutName[IndexEntry->FileName.NameLength / sizeof(WCHAR)] =
UNICODE_NULL;
ExFreePoolWithTag(BitmapData, TAG_NTFS);
@@ -678,6 +680,7 @@
UNICODE_STRING Current, Remaining, Found;
NTSTATUS Status;
WCHAR FoundName[MAX_PATH + 1];
+ ULONG FirstEntry = 0;
DPRINT1("NtfsLookupFileAt(%p, %wZ, %p, %p, %I64x)\n", Vcb, PathName,
FileRecord, DataContext, CurrentMFTIndex);
@@ -687,7 +690,7 @@
{
DPRINT1("Lookup: %wZ\n", &Current);
- Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, 0, FALSE,
&CurrentMFTIndex, FoundName);
+ Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, &FirstEntry,
FALSE, &CurrentMFTIndex, FoundName);
if (!NT_SUCCESS(Status))
{
return Status;
@@ -739,7 +742,7 @@
NTSTATUS
NtfsFindFileAt(PDEVICE_EXTENSION Vcb,
PUNICODE_STRING SearchPattern,
- ULONG FirstEntry,
+ PULONG FirstEntry,
PFILE_RECORD_HEADER *FileRecord,
PNTFS_ATTR_CONTEXT *DataContext,
PULONGLONG MFTIndex,
@@ -749,7 +752,7 @@
NTSTATUS Status;
WCHAR FoundName[MAX_PATH + 1];
- DPRINT1("NtfsFindFileAt(%p, %wZ, %p, %p, %I64x)\n", Vcb, SearchPattern,
FileRecord, DataContext, CurrentMFTIndex);
+ DPRINT1("NtfsFindFileAt(%p, %wZ, %p, %p, %p, %p, %I64x)\n", Vcb,
SearchPattern, FirstEntry, FileRecord, DataContext, MFTIndex, CurrentMFTIndex);
Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, SearchPattern, FirstEntry, TRUE,
&CurrentMFTIndex, FoundName);
if (!NT_SUCCESS(Status))
Modified: trunk/reactos/drivers/filesystems/ntfs/ntfs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/n…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Tue Oct 14 20:34:38 2014
@@ -657,7 +657,7 @@
NTSTATUS
NtfsFindFileAt(PDEVICE_EXTENSION Vcb,
PUNICODE_STRING SearchPattern,
- ULONG FirstEntry,
+ PULONG FirstEntry,
PFILE_RECORD_HEADER *FileRecord,
PNTFS_ATTR_CONTEXT *DataContext,
PULONGLONG MFTIndex,