Hello,
my storage device driver connects the file system (mountmgr) with the
pcmcia bus driver. It is used to read and write data from/to pcmcia flash
cards. The pcmcia flash cards are FAT16 formatted by an other operating
system. So far everything works well.
The problems arise as soon as i try to format a pcmcia card, because
windows has the habbit to raise the cluster (allocation unit) size and
change the file system from FAT16 to FAT12.
Now the question is: How can a driver force windows to format a partition
with FAT16 instead of FAT12? Or how can a driver specify the allocation unit
(cluster) size?
The driver receives (and handles) the following IOCTLs after a format
command has been entered: (In ther same order as they are listed)
IOCTL_DISK_CHECK_VERIFY
IOCTL_DISK_IS_WRITEABLE
IOCTL_DISK_GET_DRIVE_GEOMETRY
DiskGeometry.Cylinders.QuadPart = PartitionSize/512;
DiskGeometry.MediaType = FixedMedia;
DiskGeometry.TracksPerCylinder = 1;
DiskGeometry.SectorsPerTrack = 1;
DiskGeometry.BytesPerSector = 512;
IOCTL_DISK_GET_LENGTH_INFO
IOCTL_DISK_GET_PARTITION_INFO_EX
The parameter PARTITION_INFORMATION_EX.Mbr.PartitionType is set
to PARTITION_FAT16 but the value seems to be ignored.
IOCTL_STORAGE_GET_DEVICE_NUMBER
IOCTL_DISK_GET_DRIVE_LAYOUT_EX
PDRIVE_LAYOUT_INFORMATION_EX.PartitionCount = 4;
Type of first partition is PARTITION_FAT_16, the three remaining
partitions are set to PARTITION_ENTRY_UNUSED.
IOCTL_MOUNTDEV_QUERY_DEVICE_NAME
IOCTL_DISK_CHECK_VERIFY
IOCTL_DISK_VERIFY
Returns STATUS_SUCCESS without any futher action.
This should be ok, because the formating should only erase/reset
the file system.
IOCTL_DISK_GET_DRIVE_GEOMETRY
IOCTL_DISK_GET_PARTITION_INFO_EX
*** The boot sector is written here, but all previously supplied
file system parameters will be ignored! Why?!?
IOCTL_DISK_SET_PARTITION_INFO:
tries to write the type of the first partition to fat12. Which is
ignored because FAT12 should not be supported!
Non of the above ioctls allows a driver to change the cluster size. So
i suppose there's an other way to adjust the file system parameters.
Please let me know if you have any ideas how to ensure a partition will
be formatted with FAT16.
Thanks in advance,
Mike