http://bugs.winehq.org/show_bug.cgi?id=35983
Bug ID: 35983 Summary: Regression - mz800 emulator does not show the boot loader Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: oldium.pro@seznam.cz
Created attachment 48103 --> http://bugs.winehq.org/attachment.cgi?id=48103 Relevant back trace
I just traced down regression that happened in 1.7.3 to commit b4ab43b3de134d2816393ba7f23f67bfc36bd33f (kernel32: Remove a 0-length read optimization from ReadFile.).
The emulator can be found at http://mz-800.xf.cz/download.htm (download the emulator and extract the ROMs to the ROM directory). After starting just click the "Demo" button to start the demo.
According to the back trace the emulator is stuck in ReadFile call, which is forwarded to ReadConsoleA - see attached backtrace.
Emulator used to work like a charm in pre-1.7.3 releases.
http://bugs.winehq.org/show_bug.cgi?id=35983
Oldrich Jedlicka oldium.pro@seznam.cz changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |regression Regression SHA1| |b4ab43b3de134d2816393ba7f23 | |f67bfc36bd33f
http://bugs.winehq.org/show_bug.cgi?id=35983
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |1.7.3
http://bugs.winehq.org/show_bug.cgi?id=35983
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|regression | Status|UNCONFIRMED |NEW Component|kernel32 |-unknown Summary|Regression - mz800 emulator |mz800 emulator hangs on |does not show the boot |start |loader | Ever confirmed|0 |1 Regression SHA1|b4ab43b3de134d2816393ba7f23 | |f67bfc36bd33f |
--- Comment #1 from Dmitry Timoshkov dmitry@baikal.ru --- This looks like an application bug. The app does something like this:
hinput = GetStdHandle(STD_INPUT_HANDLE); in_size = GetFileSize(hinput); if (insize > 127) in_size -= 127; ReadFile(hinput, some_buf, in_size, &bytes_read, NULL); // <- hangs under Wine
First problem is that GetFileSize(hinput) returns 0 under Wine, but INVALID_FILE_SIZE under Windows with last error set to ERROR_INVALID_HANDLE. ReadFile(hinput, some_buf, 0, &bytes_read, NULL) waits forever for console input under both Windows and Wine, but number_of_bytes_to_read passed to ReadFile is 0 under Wine because of GetFileSize() bug => hang (wait for input). Once GetFileSize() in Wine is fixed to return INVALID_FILE_SIZE for a console handle, ReadConsoleA() attempts to allocate huge amount of memory (-128 => 0xffffff80 bytes) which fails, but ReadConsoleA() doesn't check this and forwards NULL to ReadConsoleW(), which in turn (correctly) waits for input. Once I add a check to ReadConsoleA() for memory allocation error and return FALSE with appropriate last error set the app starts to work.
http://bugs.winehq.org/show_bug.cgi?id=35983
--- Comment #2 from Dmitry Timoshkov dmitry@baikal.ru --- I sent a couple of patches which make emulator work for me:
http://www.winehq.org/pipermail/wine-patches/2014-April/131813.html http://www.winehq.org/pipermail/wine-patches/2014-April/131814.html
http://bugs.winehq.org/show_bug.cgi?id=35983
Ken Sharp imwellcushtymelike@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, patch URL| |http://mz-800.xf.cz/downloa | |d.htm
http://bugs.winehq.org/show_bug.cgi?id=35983
--- Comment #3 from Oldrich Jedlicka oldium.pro@seznam.cz --- (In reply to Dmitry Timoshkov from comment #2)
I sent a couple of patches which make emulator work for me:
http://www.winehq.org/pipermail/wine-patches/2014-April/131813.html http://www.winehq.org/pipermail/wine-patches/2014-April/131814.html
Thanks, the patches make the emulator work. I have tested it on top of 1.7.16.
http://bugs.winehq.org/show_bug.cgi?id=35983
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |e03a3fe509d525708556c6f3100 | |25db9a8cba279 Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #4 from Dmitry Timoshkov dmitry@baikal.ru --- Last patch committed as e03a3fe509d525708556c6f310025db9a8cba279.
https://bugs.winehq.org/show_bug.cgi?id=35983
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.7.17.
https://bugs.winehq.org/show_bug.cgi?id=35983
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net Component|-unknown |kernel32