http://bugs.winehq.org/show_bug.cgi?id=9988
Summary: IOCTL_SERIAL_WAIT_ON_MASK does not always return correct answer Product: Wine Version: 0.9.46. Platform: Other OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-misc AssignedTo: wine-bugs@winehq.org ReportedBy: tombrus@gmail.com
The io_control() function with IOCTL_SERIAL_WAIT_ON_MASK in dlls/ntdll/serial.c does not seem to always return the equivalent status as windows.
Unfortunately I only have an proprietary windows application (no source) that shows this. It is an application called FanControl shipped with a water cooling control unit from Innovatek (germany). The application controls the unit via an USB FTDI serial port. The application only works if there is such a device available. Rather difficult to reproduce on the average system :(.
The fix is to remove a few lines of code from the wait_on() function:
*events = check_events(fd, commio->evtmask, &commio->irq_info, &commio->irq_info, commio->mstat, commio->mstat); if (*events) goto out_now;
where the 'if' is the essential bit. The status returned to the caller will be zero when the check_events() returns something. This seems to confuse the windows application. When the above lines are taken out the returned code is always "STATUS_PENDING" and the handling through wait_for_event() will always return the right things to my windows application.
The code mentioned above looks like a shortcut to avoid starting a workitem with RtlQueueWorkItem(). My feeling is that this shortcut is not always valid.
I will attach a patch.