http://bugs.winehq.org/show_bug.cgi?id=19809
Peter Dons Tychsen donpedro@tdcadsl.dk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |donpedro@tdcadsl.dk
--- Comment #2 from Peter Dons Tychsen donpedro@tdcadsl.dk 2009-09-05 07:52:35 --- Hello Dan,
I was also annoyed by this, so i took a look. I seemed to be crashing while doing a write via NtWriteFile().
Cygwin uses a very strange way of checking handle types. It does this by calling various APIs with the handle and checks the response. (uses this to detect serial ports, regular files, consoles....).
These APIs in turn use I/O-controls to do operations on the device. In wine, the NtDeviceIoControl() forgets to check if a handle is valid or if it is appropriate. Wine does not e.g. check that serial port I/O-controls can only be applied to handles which are in fact serial ports. Windows does this.
In short, cygwin thinks that your stdin is a serial port (and other odd things)!
I wrote some tests for NtDeviceIoControl, and wrote a patch to fix the problem. Now cygwin programs all work fine in the regular terminal.
Please test with this patch. I have sent it to wine-patches as:
ntdll: Do not accept device control requests with invalid and/or incompatible handles