Note that setendoffile does not write any zeros to any selected sectors on the disk, it just highlights the pointers to spaces inside the MFT records and then updates the bitmap image of the entire file system space. But OS or FS write the valid / logical length of the file in the MFT record, if you increase it from 1 to 2 GB, then the attached 1 GB must be all zeros, but FS will not write zeros to disks, refer to this file with a valid length, to know that 1 GB should be zeros, if you try to read access to this enlarged part of 1 GB, it will fill in the Zeers directly in RAM, and then feedback with your application. But if you write access to any byte inside this part of 1 GB, FS should fill with zeros from the initial 1GB offset to the current pointer that your application is trying to apply, but not other bytes from the current location to the tail of the file, but meanwhile fixes a valid / logical lengths from 0 to current location, physical size and allocated size are still 2 GB. But if you use setfilevaliddata, FS will set the allowable length to 2GB directly and won't bother to fill in any zeros, no matter where you write, just write, but anywhere you read, you can read some garbage data that was created by others applications.
Melonhead
source share