https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4f8133f44b49a9caef0ae…
commit 4f8133f44b49a9caef0aecd0baa1394dce0dfc0e
Author: Trevor Thompson <tmt256(a)email.vccs.edu>
AuthorDate: Thu Jun 23 15:37:19 2016 +0000
[NTFS]
Fix Up AddFixupArray - It needs to accept a PNTFS_RECORD_HEADER for parameter 2, not a
PFILE_RECORD_HEADER.
svn path=/branches/GSoC_2016/NTFS/; revision=71662
---
drivers/filesystems/ntfs/mft.c | 13 +++++--------
drivers/filesystems/ntfs/ntfs.h | 2 +-
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/filesystems/ntfs/mft.c b/drivers/filesystems/ntfs/mft.c
index a53b37fb87..7017ab7695 100644
--- a/drivers/filesystems/ntfs/mft.c
+++ b/drivers/filesystems/ntfs/mft.c
@@ -698,7 +698,7 @@ UpdateFileRecord(PDEVICE_EXTENSION Vcb,
DPRINT("UpdateFileRecord(%p, %I64x, %p)\n", Vcb, index, file);
// Add the fixup array to prepare the data for writing to disk
- AddFixupArray(Vcb, file);
+ AddFixupArray(Vcb, &file->Ntfs);
// write the file record to the master file table
Status = WriteAttribute(Vcb, Vcb->MFTContext, index *
Vcb->NtfsInfo.BytesPerFileRecord, (const PUCHAR)file,
Vcb->NtfsInfo.BytesPerFileRecord, &BytesWritten);
@@ -747,27 +747,24 @@ FixupUpdateSequenceArray(PDEVICE_EXTENSION Vcb,
NTSTATUS
AddFixupArray(PDEVICE_EXTENSION Vcb,
- PFILE_RECORD_HEADER Record)
+ PNTFS_RECORD_HEADER Record)
{
USHORT *pShortToFixUp;
- unsigned int ArrayEntryCount = Record->BytesAllocated /
Vcb->NtfsInfo.BytesPerSector;
+ unsigned int ArrayEntryCount = Record->UsaCount - 1;
unsigned int Offset = Vcb->NtfsInfo.BytesPerSector - 2;
int i;
- PFIXUP_ARRAY fixupArray = (PFIXUP_ARRAY)((UCHAR*)Record +
Record->Ntfs.UsaOffset);
+ PFIXUP_ARRAY fixupArray = (PFIXUP_ARRAY)((UCHAR*)Record + Record->UsaOffset);
DPRINT("AddFixupArray(%p, %p)\n fixupArray->USN: %u, ArrayEntryCount:
%u\n", Vcb, Record, fixupArray->USN, ArrayEntryCount);
- if (Record->BytesAllocated % Vcb->NtfsInfo.BytesPerSector != 0)
- ArrayEntryCount++;
-
fixupArray->USN++;
for (i = 0; i < ArrayEntryCount; i++)
{
DPRINT("USN: %u\tOffset: %u\n", fixupArray->USN, Offset);
- pShortToFixUp = (USHORT*)((UCHAR*)Record + Offset);
+ pShortToFixUp = (USHORT*)((PCHAR)Record + Offset);
fixupArray->Array[i] = *pShortToFixUp;
*pShortToFixUp = fixupArray->USN;
Offset += Vcb->NtfsInfo.BytesPerSector;
diff --git a/drivers/filesystems/ntfs/ntfs.h b/drivers/filesystems/ntfs/ntfs.h
index 6b9a86ed07..9b12a60de8 100644
--- a/drivers/filesystems/ntfs/ntfs.h
+++ b/drivers/filesystems/ntfs/ntfs.h
@@ -811,7 +811,7 @@ FixupUpdateSequenceArray(PDEVICE_EXTENSION Vcb,
NTSTATUS
AddFixupArray(PDEVICE_EXTENSION Vcb,
- PFILE_RECORD_HEADER Record);
+ PNTFS_RECORD_HEADER Record);
NTSTATUS
ReadLCN(PDEVICE_EXTENSION Vcb,