https://bugs.winehq.org/show_bug.cgi?id=56837
--- Comment #13 from Piotr Caban piotr.caban@gmail.com --- The actual write to the file happens in _write function (not in fwrite). _write calls _lseek before writing to the file. So we're only trying to fix value returned by ftell/tell. The position where data is written to the file is not changed by any of these patches.
It's possible to find where seek is happening. I have written some tests to confirm it should not happen in every call to fwrite. I didn't add them to the patch because I don't think it shows anything useful - I have added flsbuf() tests instead.