Author: tthompson Date: Mon Jun 26 05:17:08 2017 New Revision: 75199
URL: http://svn.reactos.org/svn/reactos?rev=75199&view=rev Log: [NTFS] - Add some minor fixes and improvements: Improve, add, or fix some DPRINTs. In particular, ULONG's should use %lu, not %u. Also, don't be silent about filesystem corruption. NtfsFindMftRecord() - move CaseSensitive parameter before output parameter in parameter list.
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyste... ============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c [iso-8859-1] Mon Jun 26 05:17:08 2017 @@ -188,8 +188,8 @@ &Current, &FirstEntry, FALSE, - &CurrentMFTIndex, - CaseSensitive); + CaseSensitive, + &CurrentMFTIndex); if (!NT_SUCCESS(Status)) break;
@@ -1173,7 +1173,7 @@ while (currentOffset < IndexRootAttr->Header.TotalSizeOfEntries) { PINDEX_ENTRY_ATTRIBUTE currentIndexExtry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)IndexRootAttr + 0x10 + currentOffset); - DbgPrint(" Index Node Entry %u", currentNode++); + DbgPrint(" Index Node Entry %lu", currentNode++); if (currentIndexExtry->Flags & NTFS_INDEX_ENTRY_NODE) DbgPrint(" (Branch)"); else
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyste... ============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/blockdev.c [iso-8859-1] Mon Jun 26 05:17:08 2017 @@ -52,7 +52,7 @@ BOOLEAN AllocatedBuffer = FALSE; PUCHAR ReadBuffer = Buffer;
- DPRINT("NtfsReadDisk(%p, %I64x, %u, %u, %p, %d)\n", DeviceObject, StartingOffset, Length, SectorSize, Buffer, Override); + DPRINT("NtfsReadDisk(%p, %I64x, %lu, %lu, %p, %d)\n", DeviceObject, StartingOffset, Length, SectorSize, Buffer, Override);
KeInitializeEvent(&Event, NotificationEvent, @@ -176,7 +176,7 @@ BOOLEAN AllocatedBuffer = FALSE; PUCHAR TempBuffer = NULL;
- DPRINT("NtfsWriteDisk(%p, %I64x, %u, %u, %p)\n", DeviceObject, StartingOffset, Length, SectorSize, Buffer); + DPRINT("NtfsWriteDisk(%p, %I64x, %lu, %lu, %p)\n", DeviceObject, StartingOffset, Length, SectorSize, Buffer);
if (Length == 0) return STATUS_SUCCESS;
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyste... ============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c [iso-8859-1] Mon Jun 26 05:17:08 2017 @@ -119,7 +119,7 @@ FIND_ATTR_CONTXT Context; PNTFS_ATTR_RECORD Attribute;
- DPRINT("FindAttribute(%p, %p, 0x%x, %S, %u, %p)\n", Vcb, MftRecord, Type, Name, NameLength, AttrCtx); + DPRINT("FindAttribute(%p, %p, 0x%x, %S, %lu, %p, %p)\n", Vcb, MftRecord, Type, Name, NameLength, AttrCtx, Offset);
Found = FALSE; Status = FindFirstAttribute(&Context, Vcb, MftRecord, FALSE, &Attribute); @@ -395,6 +395,14 @@ PLARGE_INTEGER DataSize) { NTSTATUS Status = STATUS_SUCCESS; + + DPRINT1("SetAttributeDataLenth(%p, %p, %p, %lu, %p, %I64u)\n", + FileObject, + Fcb, + AttrContext, + AttrOffset, + FileRecord, + DataSize->QuadPart);
// are we truncating the file? if (DataSize->QuadPart < AttributeDataLength(&AttrContext->Record)) @@ -1336,7 +1344,7 @@ BytesRead = ReadAttribute(Vcb, Vcb->MFTContext, index * Vcb->NtfsInfo.BytesPerFileRecord, (PCHAR)file, Vcb->NtfsInfo.BytesPerFileRecord); if (BytesRead != Vcb->NtfsInfo.BytesPerFileRecord) { - DPRINT1("ReadFileRecord failed: %I64u read, %u expected\n", BytesRead, Vcb->NtfsInfo.BytesPerFileRecord); + DPRINT1("ReadFileRecord failed: %I64u read, %lu expected\n", BytesRead, Vcb->NtfsInfo.BytesPerFileRecord); return STATUS_PARTIAL_COPY; }
@@ -1370,11 +1378,11 @@ NTSTATUS Status; ULONG CurrentEntry = 0;
- DPRINT("UpdateFileNameRecord(%p, %I64d, %wZ, %u, %I64u, %I64u, %s)\n", + DPRINT("UpdateFileNameRecord(%p, %I64d, %wZ, %s, %I64u, %I64u, %s)\n", Vcb, ParentMFTIndex, FileName, - DirSearch, + DirSearch ? "TRUE" : "FALSE", NewDataSize, NewAllocationSize, CaseSensitive ? "TRUE" : "FALSE"); @@ -1466,7 +1474,20 @@ ULONGLONG IndexAllocationSize; PINDEX_BUFFER IndexBuffer;
- DPRINT("UpdateIndexEntrySize(%p, %p, %p, %u, %p, %p, %wZ, %u, %u, %u, %I64u, %I64u)\n", Vcb, MftRecord, IndexRecord, IndexBlockSize, FirstEntry, LastEntry, FileName, *StartEntry, *CurrentEntry, DirSearch, NewDataSize, NewAllocatedSize); + DPRINT("UpdateIndexEntrySize(%p, %p, %p, %lu, %p, %p, %wZ, %lu, %lu, %s, %I64u, %I64u, %s)\n", + Vcb, + MftRecord, + IndexRecord, + IndexBlockSize, + FirstEntry, + LastEntry, + FileName, + *StartEntry, + *CurrentEntry, + DirSearch ? "TRUE" : "FALSE", + NewDataSize, + NewAllocatedSize, + CaseSensitive ? "TRUE" : "FALSE");
// find the index entry responsible for the file we're trying to update IndexEntry = FirstEntry; @@ -1933,7 +1954,7 @@ ULONGLONG IndexAllocationSize; PINDEX_BUFFER IndexBuffer;
- DPRINT("BrowseIndexEntries(%p, %p, %p, %u, %p, %p, %wZ, %u, %u, %s, %s, %p)\n", + DPRINT("BrowseIndexEntries(%p, %p, %p, %lu, %p, %p, %wZ, %lu, %lu, %s, %s, %p)\n", Vcb, MftRecord, IndexRecord, @@ -1981,7 +2002,7 @@ Status = FindAttribute(Vcb, MftRecord, AttributeIndexAllocation, L"$I30", 4, &IndexAllocationCtx, NULL); if (!NT_SUCCESS(Status)) { - DPRINT("Corrupted filesystem!\n"); + DPRINT1("Corrupted filesystem!\n"); return Status; }
@@ -2031,8 +2052,8 @@ PUNICODE_STRING FileName, PULONG FirstEntry, BOOLEAN DirSearch, - ULONGLONG *OutMFTIndex, - BOOLEAN CaseSensitive) + BOOLEAN CaseSensitive, + ULONGLONG *OutMFTIndex) { PFILE_RECORD_HEADER MftRecord; PNTFS_ATTR_CONTEXT IndexRootCtx; @@ -2042,7 +2063,14 @@ NTSTATUS Status; ULONG CurrentEntry = 0;
- DPRINT("NtfsFindMftRecord(%p, %I64d, %wZ, %u, %u, %p)\n", Vcb, MFTIndex, FileName, *FirstEntry, DirSearch, OutMFTIndex); + DPRINT("NtfsFindMftRecord(%p, %I64d, %wZ, %lu, %s, %s, %p)\n", + Vcb, + MFTIndex, + FileName, + *FirstEntry, + DirSearch ? "TRUE" : "FALSE", + CaseSensitive ? "TRUE" : "FALSE", + OutMFTIndex);
MftRecord = ExAllocatePoolWithTag(NonPagedPool, Vcb->NtfsInfo.BytesPerFileRecord, @@ -2129,7 +2157,7 @@ { DPRINT("Current: %wZ\n", &Current);
- Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, &FirstEntry, FALSE, &CurrentMFTIndex, CaseSensitive); + Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, &FirstEntry, FALSE, CaseSensitive, &CurrentMFTIndex); if (!NT_SUCCESS(Status)) { return Status; @@ -2222,7 +2250,7 @@ { NTSTATUS Status;
- DPRINT("NtfsFindFileAt(%p, %wZ, %u, %p, %p, %I64x, %s)\n", + DPRINT("NtfsFindFileAt(%p, %wZ, %lu, %p, %p, %I64x, %s)\n", Vcb, SearchPattern, *FirstEntry, @@ -2231,7 +2259,7 @@ CurrentMFTIndex, (CaseSensitive ? "TRUE" : "FALSE"));
- Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, SearchPattern, FirstEntry, TRUE, &CurrentMFTIndex, CaseSensitive); + Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, SearchPattern, FirstEntry, TRUE, CaseSensitive, &CurrentMFTIndex); if (!NT_SUCCESS(Status)) { DPRINT("NtfsFindFileAt: NtfsFindMftRecord() failed with status 0x%08lx\n", Status);
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyste... ============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Mon Jun 26 05:17:08 2017 @@ -1003,8 +1003,8 @@ PUNICODE_STRING FileName, PULONG FirstEntry, BOOLEAN DirSearch, - ULONGLONG *OutMFTIndex, - BOOLEAN CaseSensitive); + BOOLEAN CaseSensitive, + ULONGLONG *OutMFTIndex);
/* misc.c */
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyste... ============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c [iso-8859-1] Mon Jun 26 05:17:08 2017 @@ -60,7 +60,7 @@ PCHAR ReadBuffer = (PCHAR)Buffer; ULONGLONG StreamSize;
- DPRINT1("NtfsReadFile(%p, %p, %p, %u, %u, %x, %p)\n", DeviceExt, FileObject, Buffer, Length, ReadOffset, IrpFlags, LengthRead); + DPRINT1("NtfsReadFile(%p, %p, %p, %lu, %lu, %lx, %p)\n", DeviceExt, FileObject, Buffer, Length, ReadOffset, IrpFlags, LengthRead);
*LengthRead = 0;
@@ -317,7 +317,7 @@ ULONG AttributeOffset; ULONGLONG StreamSize;
- DPRINT("NtfsWriteFile(%p, %p, %p, %u, %u, %x, %s, %p)\n", + DPRINT("NtfsWriteFile(%p, %p, %p, %lu, %lu, %x, %s, %p)\n", DeviceExt, FileObject, Buffer,