Microsoft KB Archive/150860

{|
 * width="100%"|

FIX: Reading Past End of Volume with FAT File Produce

 * }

Q150860

-

The information in this article applies to:


 * Microsoft Windows NT Server version 3.51
 * Microsoft Windows NT Workstation version 3.51

-

SYMPTOMS
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.

RESOLUTION
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.

STATUS
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.

Additional query words:

Keywords : kbAPI kbFileIO kbKernBase _IK kbGrpDSKernBase

Issue type : kbbug

Technology : kbWinNTsearch kbWinNTWsearch kbWinNT351xsearch kbWinNTW351xsearch kbWinNTW351 kbWinNTSsearch kbWinNTS351 kbWinNTS351xsearch