https://bugs.winehq.org/show_bug.cgi?id=51846
--- Comment #8 from Piotr Caban piotr.caban@gmail.com --- The mingw compiled executable links to msvcrt, it's visible in winedump output: offset 00003828 msvcrt.dll 0000720c 959 fopen This is why it will not work on Windows (because msvcrt doesn't support x mode).
Visual Studio compiled executable links to: offset 00002d70 api-ms-win-crt-stdio-l1-1-0.dll 0000310c 125 fopen api-ms-win-crt-stdio-l1-1-0.dll forwards to ucrtbase in wine.
This means that you have done something wrong while testing your patch. The https://source.winehq.org/patches/data/216684 patch allows Visual Studio compiled executable to work properly.