Windows API Function SetFileAttributes silently ignores compressed and encrypted attributes

When you call Windows API function SetFileAttributes, it ignores FILE_ATTRIBUTE_COMPRESSED (0x800) and FILE_ATTRIBUTE_ENCRYPTED (0x4000) values passed as parameters.

Most likely it is implemented in this way, because you can pass value from GetFileAttributes, FindFirstFile and FindNextFile without modifications to SetFileAttributes.

This applies to Windows XP, Windows Server 2003 / 2008, Windows Vista.

Leave a Reply

Your email address will not be published.