Ok, I separated the change to the handling of `FILE_READ_ATTRIBUTES` into an extra patch.
I tried replacing `((access & FILE_WRITE_ATTRIBUTES) && (flags & O_TRUNC))` with `(flags & O_TRUNC)`, but doing that makes `test_NtCreateFile` tests #16 and #17 fail:
``` /*16*/{ FILE_SUPERSEDE, 0, 0, FILE_SUPERSEDED, FILE_ATTRIBUTE_ARCHIVE, FALSE }, /*17*/{ FILE_SUPERSEDE, FILE_ATTRIBUTE_READONLY, 0, FILE_SUPERSEDED, FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY, TRUE }, ```
``` file.c:4296: Test failed: 16: expected 0 got 0xc0000022 file.c:4296: Test failed: 17: expected 0 got 0xc0000022 ```