If I used WriteFile to rewrite certain bytes in a file, would that overwrite the originaly used clusters. Or wou开发者_StackOverflowld those clusters be written to new clusters?
If you are trying to implement secure file deletion for Windows, check out SDelete. (That page also describes how it works, including how it handles compressed and/or sparse files.)
On FAT and NTFS filesystems, windows rewrites the same clusters. On media like CD-RW and DVD-RW, it may write the same clusters, but it may not. It would be easy to tell by checking the free disk space.
There might be an exception for compressed NTFS files. Rewriting some bytes could cause the number of clusters of a compressed segment to change size. In that case, I think it would free the in-use clusters for that segment and allocate a new one of the correct size.
精彩评论