set-file-valid-data · shipping · also SetFileValidData()

SetFileValidData

SetFileValidData is a privileged Windows function that advances a file's valid-data boundary without initializing the newly exposed bytes.

Related Observatory article: Read on hesela.com

The caller must enable SE_MANAGE_VOLUME_NAME before opening the handle with GENERIC_WRITE. Skipping initialization can expose previous disk contents to readers. This is not a general-purpose preallocation recommendation. [1]

Allocation size, file size and valid data length are separate stream properties. SetEndOfFile changes file size, whereas SetFileValidData changes the validity boundary. A larger boundary is therefore not evidence that the application wrote the intervening bytes. [2] [3]

MS-FSCC's FileValidDataLengthInformation describes a positive signed 64-bit value above the current VDL and at most the file size. Its documented errors include insufficient privilege and an invalid parameter for sparse or compressed files. This protocol information class must not be treated as a universal Win32 support matrix. [4]

Relations

related
File preallocation, File size, NTFS, ValidDataLength (exFAT)

Limitations

  • Access restrictions must protect still-unwritten ranges after interruptions and in later copies, not only against concurrent readers. [1]

Citations

  1. Microsoft Learn: SetFileValidData, privilege requirements and stale-content disclosure (accessed 2026-11-29)
  2. Microsoft Learn: SetEndOfFile, file size versus valid data length (accessed 2026-11-29)
  3. Microsoft Learn: FSRTL_COMMON_FCB_HEADER, separate stream length fields (accessed 2026-11-29)
  4. Microsoft MS-FSCC 2.4.50: FileValidDataLengthInformation, bounds and errors (accessed 2026-11-29)
Sources & caveats
  • Source review of Microsoft API, driver and MS-FSCC documentation, 2026-11-29. No Windows execution, performance measurement or raw-device access was performed.
  • The Win32 page disagrees internally about equality with file size and network-file support. No general guarantee is inferred for either; the MS-FSCC bounds describe a separately scoped information class.

JSON: /data/terms/set-file-valid-data.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. SetFileValidData. Hesela. 2026-11-29. https://hesela.dev/terms/set-file-valid-data/