Microsoft KB Archive/124301

{| = Why Diskspace May Return Incorrect Result =
 * width="100%"|

ID: Q124301

The information in this article applies to:


 * Microsoft FoxPro for Windows, version 2.6a

SUMMARY
Page L3-451 of the FoxPro "Language Reference" explains that the value returned by DISKSPACE may not be accurate for large network drives. This is true for any drive over 256 megabytes in size. However, the reason for this is not documented. This article provides that reason.

MORE INFORMATION
The reason is that DISKSPACE uses an MS-DOS System call that returns 16-bit values, thus limiting the size of the returned value to 65,535.

The DISKSPACE function uses INT 21h FUNCTION 36h to determine the number of sectors per cluster, available clusters, bytes per sector, and total number of clusters on a specified drive. Because this function returns a 16- bit result, DISKSPACE may report incorrect information about large (over 256 megabytes) drives.

For example, a two-gigabyte drive with a 4,000-byte cluster size has 512,000 clusters, which is much bigger than the 65,535 maximum return value. The system either reports that the clusters are much bigger than they really are, or it reports that there are many fewer clusters than there actually are. In either case, the incorrect report causes the DISKSPACE result to be off. In this example, DISKSPACE reports that the maximum free space for a two-gigabyte drive as 256 megabytes.

Additional reference words: FoxWin 2.60a KBCategory: kbenv kbdocerr KBSubcategory: FxenvHw
 * }