[3/3] msvcrt: Implement 4k block flushing behavior.

Piotr Caban piotr.caban at gmail.com
Tue Jun 3 03:56:02 CDT 2014


On 06/03/14 01:16, Grazvydas Ignotas wrote:
> I guess defaulting to 4K buffer and flushing it if it's full on
> fwrite() exit would be closer to how msvcrt operates, even though not
> entirely correct. Do you prefer this solution, or perhaps something
> entirely different?
I would like to have it implemented as similar as possible to native 
dll. So taking in account that two 2k block writes doesn't flush output 
I don't want to do it in wine.

I've added following call to your test (just after the file is opened):
setvbuf(file, NULL, _IOFBF, 512);

It causes following test failures on windows 7:
file.c:2250: Test failed: unexpected flush by 512 byte write
file.c:2250: Test failed: unexpected flush by 1024 byte write
file.c:2250: Test failed: unexpected flush by 1536 byte write
...
This shows that your code should depend on buffer size instead of 
MSVCRT_WRITE_BLOCK_SIZE.

Note: keep in mind that wine's implementation of setvbuf is quite 
broken, it's not allocating new buffer if second argument is NULL.

Thanks,
Piotr



More information about the wine-devel mailing list