Hi,
On 6/11/20 1:10 AM, Pauli wrote:
When I tested the buffered output I had mixed results. Characters rendedred correctly in wineconsole cmd. Too bad output was still grabage because same output was written multiple times.
I've sent a patch for fflush function that clears the buffer even if error occurs (https://source.winehq.org/patches/data/186903). It should fix some of the cases when output is written multiple times.
After reading wine debug log I figured that issue was around WriteFile call from MSVCRT__write. stdout has WX_TEXT set leading to path which assumes WriteFile sets BytesWritten to actual number of bytes. But kernel32.WriteFile does mb to wc conversion (correctly) but it then writes number of wide characters written.
In the tests you have attached the fflush failure is caused by incorrect value set by ConsoleWriteA function. On Wine ConsoleWriteA(sout, test, sizeof(test) - 1, &written, NULL) sets written to 1, on Windows to 3. Please create a bug report about that (bugs.winehq.org).
Thanks, Piotr