Author: pschweitzer
Date: Fri Sep 26 18:12:24 2014
New Revision: 64316
URL:
http://svn.reactos.org/svn/reactos?rev=64316&view=rev
Log:
[NTFS]
- Divert NtfsLookupFile() as NtfsLookupFileAt() to allow opening relatives to a current
MFT record.
- Reimplement NtfsLookupFile() using NtfsLookupFileAt()
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] Fri Sep 26 18:12:24 2014
@@ -645,54 +645,62 @@
}
NTSTATUS
+NtfsLookupFileAt(PDEVICE_EXTENSION Vcb,
+ PUNICODE_STRING PathName,
+ PFILE_RECORD_HEADER *FileRecord,
+ PNTFS_ATTR_CONTEXT *DataContext,
+ ULONGLONG CurrentMFTIndex)
+{
+ UNICODE_STRING Current, Remaining;
+ NTSTATUS Status;
+
+ DPRINT1("NtfsLookupFileAt(%p, %wZ, %p, %p, %I64x)\n", Vcb, PathName,
FileRecord, DataContext, CurrentMFTIndex);
+
+ FsRtlDissectName(*PathName, &Current, &Remaining);
+
+ while (Current.Length != 0)
+ {
+ DPRINT1("Lookup: %wZ\n", &Current);
+
+ Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current,
&CurrentMFTIndex);
+ if (!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
+
+ FsRtlDissectName(*PathName, &Current, &Remaining);
+ }
+
+ *FileRecord = ExAllocatePoolWithTag(NonPagedPool,
Vcb->NtfsInfo.BytesPerFileRecord, TAG_NTFS);
+ if (*FileRecord == NULL)
+ {
+ DPRINT("NtfsLookupFile: Can't allocate MFT record\n");
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ Status = ReadFileRecord(Vcb, CurrentMFTIndex, *FileRecord);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("NtfsLookupFile: Can't read MFT record\n");
+ return Status;
+ }
+
+ Status = FindAttribute(Vcb, *FileRecord, AttributeData, PathName, DataContext);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("NtfsLookupFile: Can't find data attribute\n");
+ return Status;
+ }
+
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
NtfsLookupFile(PDEVICE_EXTENSION Vcb,
PUNICODE_STRING PathName,
PFILE_RECORD_HEADER *FileRecord,
PNTFS_ATTR_CONTEXT *DataContext)
{
- ULONGLONG CurrentMFTIndex;
- UNICODE_STRING Current, Remaining;
- NTSTATUS Status;
-
- DPRINT1("NtfsLookupFile(%p, %wZ, %p)\n", Vcb, PathName, FileRecord);
-
- CurrentMFTIndex = NTFS_FILE_ROOT;
- FsRtlDissectName(*PathName, &Current, &Remaining);
-
- while (Current.Length != 0)
- {
- DPRINT1("Lookup: %wZ\n", &Current);
-
- Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current,
&CurrentMFTIndex);
- if (!NT_SUCCESS(Status))
- {
- return Status;
- }
-
- FsRtlDissectName(*PathName, &Current, &Remaining);
- }
-
- *FileRecord = ExAllocatePoolWithTag(NonPagedPool,
Vcb->NtfsInfo.BytesPerFileRecord, TAG_NTFS);
- if (*FileRecord == NULL)
- {
- DPRINT("NtfsLookupFile: Can't allocate MFT record\n");
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- Status = ReadFileRecord(Vcb, CurrentMFTIndex, *FileRecord);
- if (!NT_SUCCESS(Status))
- {
- DPRINT("NtfsLookupFile: Can't read MFT record\n");
- return Status;
- }
-
- Status = FindAttribute(Vcb, *FileRecord, AttributeData, PathName, DataContext);
- if (!NT_SUCCESS(Status))
- {
- DPRINT("NtfsLookupFile: Can't find data attribute\n");
- return Status;
- }
-
- return STATUS_SUCCESS;
+ return NtfsLookupFileAt(Vcb, PathName, FileRecord, DataContext, NTFS_FILE_ROOT);
}
/* EOF */
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] Fri Sep 26 18:12:24 2014
@@ -634,6 +634,13 @@
PFILE_RECORD_HEADER *FileRecord,
PNTFS_ATTR_CONTEXT *DataContext);
+NTSTATUS
+NtfsLookupFileAt(PDEVICE_EXTENSION Vcb,
+ PUNICODE_STRING PathName,
+ PFILE_RECORD_HEADER *FileRecord,
+ PNTFS_ATTR_CONTEXT *DataContext,
+ ULONGLONG CurrentMFTIndex);
+
/* misc.c */
BOOLEAN