60 CHAPTER 3 ADVANCED FILE AND DIRECTORY PROCESSING, AND THE REGISTRY
file in which you currently expect to have valid data, saving time when you set the
physical end. The file’s tail is the portion between the logical and physical ends,
and the tail can be shortened by writing data past the logical end or with another
call to SetFileValidData.
With sparse files, which were introduced with Windows 2000, disk space is
consumed only as data is written. A file, directory, or volume can be specified to be
sparse by the administrator. Also, the DeviceIoControl function can use the
FSCTL_SET_SPARSE flag to specify that an existing file is sparse. Program 3–1
will illustrate a situation where a sparse file can be used conveniently. Set-
ValidFileData does ...