http://bugs.winehq.org/show_bug.cgi?id=2960
Summary: Bug in int 21, function 3f (read) causing WATCOM Win386 Read error Product: Wine Version: unspecified Platform: All OS/Version: All Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-dos AssignedTo: wine-bugs@winehq.org ReportedBy: lupien@physique.usherbrooke.ca
An old windows 3.1 program (compiled with a watcom compiler) was failing with the message Read Error in a window called WATCOM Win386. I found the problem was due to count being set to 0 in int21, function 3f. In my case the GetSelectorLimit16 was set at 0xffff (DX was set 0) and would make maxcount 0.
Below is a simple fix (making maxcount a double). in dlls/winedos --- int21.c.orig 2005-05-13 21:21:32.000000000 -0400 +++ int21.c 2005-05-13 21:24:36.000000000 -0400 @@ -4744,7 +4744,7 @@ /* Some programs pass a count larger than the allocated buffer */ if (DOSVM_IsWin16()) { - WORD maxcount = GetSelectorLimit16( context->SegDs ) + DWORD maxcount = GetSelectorLimit16( context->SegDs ) - DX_reg(context) + 1; if (count > maxcount) count = maxcount;