FIX: Reading Past End of Volume with FAT File ProduceID: Q150860
|
Windows NT allows access to partitions by opening a volume using the
"\\.\x:" nomenclature. When an application reads beyond the end of a volume
formatted with the FAT file system, Windows NT causes the read operation to
fail and GetLastError to return ERROR_INVALID_PARAMETER. This behavior is
incorrect.
When an application reads beyond the end of a volume, the read operation
should complete successfully, and the number of bytes read will be the
count of bytes from the starting location of the read up to the end of the
volume. This number may be less the number that was actually requested.
Subsequent reads should also succeed, but with zero bytes actually read.
This indicates the End-Of_File (EOF) condition. This is the correct
behavior.
To work around the behavior of ReadFile on volumes formatted with the FAT file system, do not perform read operations that extend beyond the length of the volume. The length of the volume is determined by examining the results of the DeviceIoControl function when called with the IOCTL_DISK_GET_PARTITION_INFO control code. The PartitionLength member of the PARTITION_INFORMATION structure filled out by the IOCTL contains a pair of DWORDS that indicate the size of the volume in bytes.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in Windows NT, version 4.0.
Keywords : kbAPI kbKernBase kbGrpKernBase
Version : 3.51
Platform : NT WINDOWS
Issue type : kbbug
Last Reviewed: March 10, 1999