FIX: Reading Past End of Volume with FAT File ProduceLast reviewed: October 29, 1997Article ID: Q150860 |
The information in this article applies to:
SYMPTOMSWindows 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.
RESOLUTIONTo 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.
STATUSMicrosoft 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 : BseFileio buglist3.51 kbprg fixlist4.00 kbbuglist kbfixlist Version : 3.51 Platform : NT WINDOWS Issue type : kbbug Solution Type : kbfix |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |