The bug in the handling of text mode files with CTRL-Z's at the end is back.
Due to compatibility with DOS, which is compatible with CP/M, text mode files may be padded with a number of CTRL-Z characters (\x1A) to fill out a sector.
The current Wine implementation of MSVCRT does NOT strip these - this breaks several programs, among them Delorme Street Atlas 5 (my test case for this.)
The attached patch corrects this behavior.
Changelog: dlls/msvcrt/file.c David Hagood (wowbagger at sktc.net) Remove CTRL-Z's at EOF of text mode files
Index: dlls/msvcrt/file.c =================================================================== RCS file: /home/wine/wine/dlls/msvcrt/file.c,v retrieving revision 1.107 diff -u -u -r1.107 file.c --- dlls/msvcrt/file.c 31 Jul 2006 20:02:38 -0000 1.107 +++ dlls/msvcrt/file.c 5 Aug 2006 15:10:33 -0000 @@ -1638,6 +1638,21 @@ { MSVCRT_fdesc[fd].wxflag |= WX_ATEOF; TRACE(":EOF %s\n",debugstr_an(buf,num_read)); + if (MSVCRT_fdesc[fd].wxflag & WX_TEXT) + { + /* if at EOF in text mode, we need to remove any final CTRL-Z's + from the file. Ahh the joys of CP/M^WDOS compatibility. + */ + if (num_read && (bufstart[num_read-1] == 0x1a)) + { + while (num_read && (bufstart[num_read-1] == 0x1a)) + { + num_read --; + } + TRACE("Removing CTRL-Z from EOF\n"); + bufstart[num_read-1] = 0; + } + } } } else