Author: pschweitzer
Date: Wed Dec 10 20:45:04 2014
New Revision: 65601
URL:
http://svn.reactos.org/svn/reactos?rev=65601&view=rev
Log:
[NTFS]
Implement the downward fashion of FSCTL_GET_NTFS_FILE_RECORD and always return a file
record which is in use
CORE-8725
Modified:
trunk/reactos/drivers/filesystems/ntfs/fsctl.c
Modified: trunk/reactos/drivers/filesystems/ntfs/fsctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/fsctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/fsctl.c [iso-8859-1] Wed Dec 10 20:45:04 2014
@@ -626,14 +626,23 @@
InputBuffer = (PNTFS_FILE_RECORD_INPUT_BUFFER)Irp->AssociatedIrp.SystemBuffer;
MFTRecord = InputBuffer->FileReferenceNumber.QuadPart;
- Status = ReadFileRecord(DeviceExt, MFTRecord, FileRecord);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed reading record: %I64x\n", MFTRecord);
- ExFreePoolWithTag(FileRecord, TAG_NTFS);
- return Status;
- }
-
+ DPRINT1("Requesting: %I64x\n", MFTRecord);
+
+ do
+ {
+ Status = ReadFileRecord(DeviceExt, MFTRecord, FileRecord);
+ if (NT_SUCCESS(Status))
+ {
+ if (FileRecord->Flags & FRH_IN_USE)
+ {
+ break;
+ }
+ }
+
+ --MFTRecord;
+ } while (TRUE);
+
+ DPRINT1("Returning: %I64x\n", MFTRecord);
OutputBuffer = (PNTFS_FILE_RECORD_OUTPUT_BUFFER)Irp->AssociatedIrp.SystemBuffer;
OutputBuffer->FileReferenceNumber.QuadPart = MFTRecord;
OutputBuffer->FileRecordLength = DeviceExt->NtfsInfo.BytesPerFileRecord;