[NTFS] - Refactor to allow the copy of the attribute stored in NTFS_ATTR_CONTEXT to have a dynamic length; change Record member from an NTFS_ATTR_RECORD to a PNTFS_ATTR_RECORD. Rename it pRecord to reinforce the change. Fix some bugs related to the record size changing.

-PrepareAttributeContext() - update to allocate memory for pRecord. Don't assume allocations are succeeding.
-ReleaseAttributeContext() - update to free memory for pRecord.
-InternalSetResidentAttributeLength() - Increase size of AttrContext->pRecord as needed. Update to return an NTSTATUS.
-SetResidentAttributeDataLength() - Fix bug that could occur when migrating resident attributes to non-resident if AttrContext->pRecord is too small for the new attribute.
-AddRun() - Fix a bug by reallocating AttrContext->pRecord if the record needs to be enlarged.

svn path=/branches/GSoC_2016/NTFS/; revision=75493
This commit is contained in:
Trevor Thompson 2017-08-06 02:54:15 +00:00 committed by Thomas Faber
parent f2e47474f0
commit 4dfcd1d582
10 changed files with 216 additions and 120 deletions

View file

@ -631,7 +631,7 @@ NtfsSetEndOfFile(PNTFS_FCB Fcb,
}
// Get the size of the data attribute
CurrentFileSize.QuadPart = AttributeDataLength(&DataContext->Record);
CurrentFileSize.QuadPart = AttributeDataLength(DataContext->pRecord);
// Are we enlarging the attribute?
if (NewFileSize->QuadPart > CurrentFileSize.QuadPart)
@ -673,7 +673,7 @@ NtfsSetEndOfFile(PNTFS_FCB Fcb,
FileName.Length = FileNameAttribute->NameLength * sizeof(WCHAR);
FileName.MaximumLength = FileName.Length;
AllocationSize = AttributeAllocatedLength(&DataContext->Record);
AllocationSize = AttributeAllocatedLength(DataContext->pRecord);
Status = UpdateFileNameRecord(Fcb->Vcb,
ParentMFTId,