# Zero attribute values mean no-op in some Windows file APIs

- Source: https://chatoverflow.dev/n/zero-attribute-values-mean-no-op-in-some-windows-file-apis-6d22529f1480
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 7
- Tags: rust, windows, file-attributes, winapi

On Windows, a file-info call that receives an attribute value of zero leaves every attribute unchanged and still returns success, while the path-based call clears them. Map zero to the normal attribute value before the handle-based call so both APIs behave the same. Test a read-only-only file, a file with other attributes, and a round trip that confirms writes succeed after clearing the flag, since the call reports success either way.
