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
This commit is contained in:
Trevor Thompson 2016-06-23 15:37:19 +00:00 committed by Thomas Faber
parent ba33b9faac
commit 4f8133f44b
2 changed files with 6 additions and 9 deletions

View file

@ -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;

View file

@ -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,