- Removed some useless debug
Thanks to Hervé

svn path=/trunk/; revision=32462
This commit is contained in:
Pierre Schweitzer 2008-02-24 10:06:37 +00:00
parent 2b17735b1a
commit a68d895e4d
2 changed files with 45 additions and 29 deletions

View file

@ -21,7 +21,8 @@
* FILE: drivers/filesystems/ntfs/fsctl.c * FILE: drivers/filesystems/ntfs/fsctl.c
* PURPOSE: NTFS filesystem driver * PURPOSE: NTFS filesystem driver
* PROGRAMMER: Eric Kohl * PROGRAMMER: Eric Kohl
* Updated by Valentin Verkhovsky 2003/09/12 * Valentin Verkhovsky
* Pierre Schweitzer
*/ */
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
@ -44,9 +45,9 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
{ {
PARTITION_INFORMATION PartitionInfo; PARTITION_INFORMATION PartitionInfo;
DISK_GEOMETRY DiskGeometry; DISK_GEOMETRY DiskGeometry;
ULONG Size;
PBOOT_SECTOR BootSector; PBOOT_SECTOR BootSector;
NTSTATUS Status; NTSTATUS Status;
ULONG Size, k;
DPRINT1("NtfsHasFileSystem() called\n"); DPRINT1("NtfsHasFileSystem() called\n");
@ -102,18 +103,45 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
DiskGeometry.BytesPerSector, DiskGeometry.BytesPerSector,
(PVOID)BootSector, (PVOID)BootSector,
TRUE); TRUE);
if (NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NTFS-identifier: [%.8s]\n", BootSector->OEMID); goto ByeBye;
}
/* Check values of different fields. If those fields have not expected
* values, we fail, to avoid mounting partitions that Windows won't mount.
*/
/* OEMID: this field must be NTFS */
if (RtlCompareMemory(BootSector->OEMID, "NTFS ", 8) != 8) if (RtlCompareMemory(BootSector->OEMID, "NTFS ", 8) != 8)
{ {
DPRINT1("Failed with NTFS-identifier: [%.8s]\n", BootSector->OEMID);
Status = STATUS_UNRECOGNIZED_VOLUME; Status = STATUS_UNRECOGNIZED_VOLUME;
goto ByeBye;
}
/* Unused0: this field must be COMPLETELY null */
for (k=0; k<7; k++)
{
if (BootSector->BPB.Unused0[k] != 0)
{
DPRINT1("Failed in field Unused0: [%.7s]\n", BootSector->BPB.Unused0);
Status = STATUS_UNRECOGNIZED_VOLUME;
goto ByeBye;
}
}
/* Unused3: this field must be COMPLETELY null */
for (k=0; k<4; k++)
{
if (BootSector->BPB.Unused3[k] != 0)
{
DPRINT1("Failed in field Unused3: [%.4s]\n", BootSector->BPB.Unused3);
Status = STATUS_UNRECOGNIZED_VOLUME;
goto ByeBye;
} }
} }
ByeBye:
ExFreePool(BootSector); ExFreePool(BootSector);
return Status;
return(Status);
} }
@ -181,21 +209,15 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
else else
NtfsInfo->BytesPerFileRecord = 1 << (-BootSector->EBPB.ClustersPerMftRecord); NtfsInfo->BytesPerFileRecord = 1 << (-BootSector->EBPB.ClustersPerMftRecord);
//#ifndef NDEBUG DPRINT("Boot sector information:\n");
DbgPrint("Boot sector information:\n"); DPRINT(" BytesPerSector: %hu\n", BootSector->BPB.BytesPerSector);
DbgPrint(" BytesPerSector: %hu\n", BootSector->BPB.BytesPerSector); DPRINT(" SectorsPerCluster: %hu\n", BootSector->BPB.SectorsPerCluster);
DbgPrint(" SectorsPerCluster: %hu\n", BootSector->BPB.SectorsPerCluster); DPRINT(" SectorCount: %I64u\n", BootSector->EBPB.SectorCount);
DPRINT(" MftStart: %I64u\n", BootSector->EBPB.MftLocation);
DbgPrint(" SectorCount: %I64u\n", BootSector->EBPB.SectorCount); DPRINT(" MftMirrStart: %I64u\n", BootSector->EBPB.MftMirrLocation);
DPRINT(" ClustersPerMftRecord: %lx\n", BootSector->EBPB.ClustersPerMftRecord);
DbgPrint(" MftStart: %I64u\n", BootSector->EBPB.MftLocation); DPRINT(" ClustersPerIndexRecord: %lx\n", BootSector->EBPB.ClustersPerIndexRecord);
DbgPrint(" MftMirrStart: %I64u\n", BootSector->EBPB.MftMirrLocation); DPRINT(" SerialNumber: %I64x\n", BootSector->EBPB.SerialNumber);
DbgPrint(" ClustersPerMftRecord: %lx\n", BootSector->EBPB.ClustersPerMftRecord);
DbgPrint(" ClustersPerIndexRecord: %lx\n", BootSector->EBPB.ClustersPerIndexRecord);
DbgPrint(" SerialNumber: %I64x\n", BootSector->EBPB.SerialNumber);
//#endif
ExFreePool(BootSector); ExFreePool(BootSector);
@ -234,17 +256,11 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
return Status; return Status;
} }
#ifndef NDEBUG
DbgPrint("\n\n");
/* Enumerate attributes */ /* Enumerate attributes */
NtfsDumpFileAttributes (MftRecord); NtfsDumpFileAttributes (MftRecord);
DbgPrint("\n\n");
DbgPrint("\n\n");
/* Enumerate attributes */ /* Enumerate attributes */
NtfsDumpFileAttributes (VolumeRecord); NtfsDumpFileAttributes (VolumeRecord);
DbgPrint("\n\n");
#endif
/* Get volume name */ /* Get volume name */
Attribute = FindAttribute (VolumeRecord, AttributeVolumeName, NULL); Attribute = FindAttribute (VolumeRecord, AttributeVolumeName, NULL);

View file

@ -38,7 +38,7 @@ typedef struct _BIOS_PARAMETERS_BLOCK
typedef struct _EXTENDED_BIOS_PARAMETERS_BLOCK typedef struct _EXTENDED_BIOS_PARAMETERS_BLOCK
{ {
UCHAR Unknown[4]; // 0x24, always 80 00 80 00 USHORT Unknown[2]; // 0x24, always 80 00 80 00
ULONGLONG SectorCount; // 0x28 ULONGLONG SectorCount; // 0x28
ULONGLONG MftLocation; // 0x30 ULONGLONG MftLocation; // 0x30
ULONGLONG MftMirrLocation; // 0x38 ULONGLONG MftMirrLocation; // 0x38