Author: pschweitzer Date: Fri May 30 13:55:05 2008 New Revision: 33779
URL: http://svn.reactos.org/svn/reactos?rev=33779&view=rev Log: Check cluster size when mounting a volume
Modified: trunk/reactos/drivers/filesystems/ntfs/fsctl.c
Modified: trunk/reactos/drivers/filesystems/ntfs/fsctl.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/fs... ============================================================================== --- trunk/reactos/drivers/filesystems/ntfs/fsctl.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/ntfs/fsctl.c [iso-8859-1] Fri May 30 13:55:05 2008 @@ -45,9 +45,9 @@ { PARTITION_INFORMATION PartitionInfo; DISK_GEOMETRY DiskGeometry; + ULONG ClusterSize, Size, k; PBOOT_SECTOR BootSector; NTSTATUS Status; - ULONG Size, k;
DPRINT1("NtfsHasFileSystem() called\n");
@@ -91,7 +91,7 @@
DPRINT1("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector); BootSector = ExAllocatePoolWithTag(NonPagedPool, - DiskGeometry.BytesPerSector, TAG_NTFS); + DiskGeometry.BytesPerSector, TAG_NTFS); if (BootSector == NULL) { return(STATUS_INSUFFICIENT_RESOURCES); @@ -137,6 +137,17 @@ Status = STATUS_UNRECOGNIZED_VOLUME; goto ByeBye; } + } + /* Check cluster size */ + ClusterSize = BootSector->BPB.BytesPerSector * BootSector->BPB.SectorsPerCluster; + if (ClusterSize != 512 && ClusterSize != 1024 && + ClusterSize != 2048 && ClusterSize != 4096) + { + DPRINT1("Cluster size failed: %hu, %hu, %hu\n", BootSector->BPB.BytesPerSector, + BootSector->BPB.SectorsPerCluster, + ClusterSize); + Status = STATUS_UNRECOGNIZED_VOLUME; + goto ByeBye; }
ByeBye: