[PATCH] server/console: ensure conhost has created the TTY input stream before waiting

Jacek Caban jacek at codeweavers.com
Tue Dec 14 12:40:25 CST 2021


Hi Eric,

On 12/8/21 3:56 PM, Eric Pouech wrote:
> some PE executables (like mingw's gdb port) just do something like:
> - WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), INFINITE) and hang
>    for ever (the read operations are done*after*  the wait operation
>    succeeds)
> (of course, the real wait operation is more complex, but the problematic
> part boils down to that)
>
> this hangs for ever because conhost's main input thread hasn't been started
> yet
>
> this patch sends once a peek IOCTL before waiting, hence ensuring conhost's
> main input stream has been started
>
> this lets i686 and x64_86 mingw's gdb port to accept user's input
>
> (this is second attempt to fix this bug, based on Jacek's feedback on
> first try)


I think this is a good solution in general. Looking closer, we will also 
need it for console_ops as well. Those are two different objects: one is 
meant for handles operating on currently attached console while the 
other is always attached to specific console.


I'd suggest setting the initialization flag in IOCTL_CONDRV_SETUP_INPUT 
as a cheap optimization for cases when input is read before waiting. 
Please keep white space changes consistent with server style.


Thanks,

Jacek




More information about the wine-devel mailing list