Fixes issue that SetFileAttributes(..., FILE_ATTRIBUTE_NORMAL) can
clean attributes prohibited to clean, for example, FILE_ATTRIBUTE_DIRECTORY .
See SetFileAttributesW documentation.
Checklist
[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas
[ ] I have made corresponding changes to the existing documentation
[x] My changes generate no new warnings
[ ] I have updated the change log (Add/Change/Fix)
[x] I have cleaned up the commit history (use rebase and squash)
Changes proposed in this pull request:
Operate on allowed attributes only
Remove incorrect behavior in case fileattributes == 0
Fixes issue that
SetFileAttributes(..., FILE_ATTRIBUTE_NORMAL)
can clean attributes prohibited to clean, for example,FILE_ATTRIBUTE_DIRECTORY
. See SetFileAttributesW documentation.Checklist
Changes proposed in this pull request:
fileattributes == 0
(fileattributes & (fileattributes - 1))