Hi Paul, I'm having a hard time reviewing the patch (I'm referring to the first commit, I didn't look on the second one yet). While I like some of the cleanups you're doing you're also introducing unrelated changes. E.g. in std handles initialization loop you're no longer checking `wxflag_ptr[i] & WX_OPEN` (which is probably wrong and not covered by the tests). It would be best to move the cleanup to separate commit. It looks like WX_TEXT is treated differently than other flags. I have tested that WX_TTY is preserved in fd attributes (by setting 0x41 flag in `create_io_inherit_block`, passing file handle and calling `isatty()`). This is something that used to work and breaks with your patch. The tests you're adding will pass if WX_TEXT flag is set for std handles. Something like: ```c msvcrt_set_fd(fdinfo, *handle_ptr, *wxflag_ptr | (i < 3 ? WX_TEXT : 0)); ``` will do the job. While it would be good to test other attributes I think it's closer to what native does. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11710#note_149438