Author: pschweitzer
Date: Sat Nov 1 10:02:08 2014
New Revision: 65166
URL:
http://svn.reactos.org/svn/reactos?rev=65166&view=rev
Log:
[NTFS]
Simplify buffer size management in GetNtfsFileRecord(). As tests shown, Windows
doesn't care about the real size of the file record and expects the caller to pass the
complete size of the record and returns it fully.
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] Sat Nov 1 10:02:08 2014
@@ -608,7 +608,7 @@
return STATUS_INVALID_PARAMETER;
}
- if (Stack->Parameters.FileSystemControl.OutputBufferLength <
sizeof(NTFS_FILE_RECORD_OUTPUT_BUFFER) ||
+ if (Stack->Parameters.FileSystemControl.OutputBufferLength <
(FIELD_OFFSET(NTFS_FILE_RECORD_OUTPUT_BUFFER, FileRecordBuffer) +
DeviceExt->NtfsInfo.BytesPerFileRecord) ||
Irp->AssociatedIrp.SystemBuffer == NULL)
{
DPRINT1("Invalid output! %d %p\n",
Stack->Parameters.FileSystemControl.OutputBufferLength,
Irp->AssociatedIrp.SystemBuffer);
@@ -634,17 +634,10 @@
return Status;
}
- if (Stack->Parameters.FileSystemControl.OutputBufferLength <
(FIELD_OFFSET(NTFS_FILE_RECORD_OUTPUT_BUFFER, FileRecordBuffer) +
FileRecord->BytesInUse))
- {
- DPRINT1("Buffer too small: %lu vs %lu\n",
Stack->Parameters.FileSystemControl.OutputBufferLength, FileRecord->BytesInUse);
- ExFreePoolWithTag(FileRecord, TAG_NTFS);
- return STATUS_BUFFER_TOO_SMALL;
- }
-
OutputBuffer = (PNTFS_FILE_RECORD_OUTPUT_BUFFER)Irp->AssociatedIrp.SystemBuffer;
OutputBuffer->FileReferenceNumber.QuadPart = MFTRecord;
- OutputBuffer->FileRecordLength = FileRecord->BytesInUse;
- RtlCopyMemory(OutputBuffer->FileRecordBuffer, FileRecord,
FileRecord->BytesInUse);
+ OutputBuffer->FileRecordLength = DeviceExt->NtfsInfo.BytesPerFileRecord;
+ RtlCopyMemory(OutputBuffer->FileRecordBuffer, FileRecord,
DeviceExt->NtfsInfo.BytesPerFileRecord);
ExFreePoolWithTag(FileRecord, TAG_NTFS);