Hi.
I have problems with obtaining FAT32 volume data. For NTFS there's a
FSCTL_GET_NTFS_VOLUME_DATA control code, and nothing similar for
FAT32. Actually I need only 2 pieces of information:
1) The offset of the starting sector of the volume from the beginning
of the disk;
2) The number of the sectors per cluster, or the number of bytes per
cluster.
At the first glance you may think it's easy to obtain them using
IOCTL_DISK_GET_PARTITION_INFO control code, but the things are
somewhat complicated. For NTFS volume the starting sector offset can
be obtained easily dividing the starting offset of the partition (in
bytes) by the number of the bytes per sector (the mentioned arguments
are obtained through IOCTL_DISK_GET_PARTITION_INFO and
IOCTL_DISK_GET_DRIVE_GEOMETRY control codes). For FAT32 volumes data
sectors start from partition offset + reserved sectors + n*FAT size,
and it's impossible to get these arguments through any conrol code.
The only obvious way to obtain them is reading sector 0 of the
partition, which contains all the necessary data. Unfortunately I have
problems with reading exactly sector 0 - a legacy filter driver
encrypts/decrypts all read/write operations and it functions
incorrectly just for sector 0 read operation, as a result I get
garbage.
Question: Is there another way to obtain the 2 abovementioned pieces
of volume information?
Thanks in advance
Martin