https://git.reactos.org/?p=reactos.git;a=commitdiff;h=38c947b7abde91ce68d27…
commit 38c947b7abde91ce68d27e5f18553ca2f1747274
Author: Trevor Thompson <tmt256(a)email.vccs.edu>
AuthorDate: Mon Jun 26 05:17:08 2017 +0000
[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.
svn path=/branches/GSoC_2016/NTFS/; revision=75199
---
drivers/filesystems/ntfs/attrib.c | 6 ++---
drivers/filesystems/ntfs/blockdev.c | 4 +--
drivers/filesystems/ntfs/mft.c | 54 ++++++++++++++++++++++++++++---------
drivers/filesystems/ntfs/ntfs.h | 4 +--
drivers/filesystems/ntfs/rw.c | 4 +--
5 files changed, 50 insertions(+), 22 deletions(-)
diff --git a/drivers/filesystems/ntfs/attrib.c b/drivers/filesystems/ntfs/attrib.c
index 7669008f99..90e20d3819 100644
--- a/drivers/filesystems/ntfs/attrib.c
+++ b/drivers/filesystems/ntfs/attrib.c
@@ -188,8 +188,8 @@ AddFileName(PFILE_RECORD_HEADER FileRecord,
&Current,
&FirstEntry,
FALSE,
- &CurrentMFTIndex,
- CaseSensitive);
+ CaseSensitive,
+ &CurrentMFTIndex);
if (!NT_SUCCESS(Status))
break;
@@ -1173,7 +1173,7 @@ NtfsDumpIndexRootAttribute(PNTFS_ATTR_RECORD Attribute)
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
diff --git a/drivers/filesystems/ntfs/blockdev.c b/drivers/filesystems/ntfs/blockdev.c
index 1ae67e52d7..70658b03c3 100644
--- a/drivers/filesystems/ntfs/blockdev.c
+++ b/drivers/filesystems/ntfs/blockdev.c
@@ -52,7 +52,7 @@ NtfsReadDisk(IN PDEVICE_OBJECT DeviceObject,
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 @@ NtfsWriteDisk(IN PDEVICE_OBJECT DeviceObject,
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;
diff --git a/drivers/filesystems/ntfs/mft.c b/drivers/filesystems/ntfs/mft.c
index e83c33e6de..6ffe8d53ad 100644
--- a/drivers/filesystems/ntfs/mft.c
+++ b/drivers/filesystems/ntfs/mft.c
@@ -119,7 +119,7 @@ FindAttribute(PDEVICE_EXTENSION Vcb,
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);
@@ -396,6 +396,14 @@ SetAttributeDataLength(PFILE_OBJECT FileObject,
{
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 @@ ReadFileRecord(PDEVICE_EXTENSION Vcb,
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 @@ UpdateFileNameRecord(PDEVICE_EXTENSION Vcb,
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 @@ UpdateIndexEntryFileNameSize(PDEVICE_EXTENSION Vcb,
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 @@ BrowseIndexEntries(PDEVICE_EXTENSION Vcb,
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 @@ BrowseIndexEntries(PDEVICE_EXTENSION Vcb,
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 @@ NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
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 @@ NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
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 @@ NtfsLookupFileAt(PDEVICE_EXTENSION Vcb,
{
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 @@ NtfsFindFileAt(PDEVICE_EXTENSION Vcb,
{
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 @@ NtfsFindFileAt(PDEVICE_EXTENSION Vcb,
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);
diff --git a/drivers/filesystems/ntfs/ntfs.h b/drivers/filesystems/ntfs/ntfs.h
index b2633c0dd8..d738ef5fe2 100644
--- a/drivers/filesystems/ntfs/ntfs.h
+++ b/drivers/filesystems/ntfs/ntfs.h
@@ -1003,8 +1003,8 @@ NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
PUNICODE_STRING FileName,
PULONG FirstEntry,
BOOLEAN DirSearch,
- ULONGLONG *OutMFTIndex,
- BOOLEAN CaseSensitive);
+ BOOLEAN CaseSensitive,
+ ULONGLONG *OutMFTIndex);
/* misc.c */
diff --git a/drivers/filesystems/ntfs/rw.c b/drivers/filesystems/ntfs/rw.c
index 1cfdd7fde2..215269a25c 100644
--- a/drivers/filesystems/ntfs/rw.c
+++ b/drivers/filesystems/ntfs/rw.c
@@ -60,7 +60,7 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
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 @@ NTSTATUS NtfsWriteFile(PDEVICE_EXTENSION DeviceExt,
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,