https://bugs.winehq.org/show_bug.cgi?id=52771
Bug ID: 52771 Summary: Wine console creation breaks comctl32:button, dinput:keyboard, user32:dialog, user32:input, user32:monitor and user32:win Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: programs Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com Distribution: ---
The way Wine creates the window for console applications breaks comctl32:button, dinput:keyboard, user32:dialog, user32:input, user32:monitor and user32:win.
https://test.winehq.org/data/patterns.html#comctl32:button https://test.winehq.org/data/patterns.html#dinput:keyboard https://test.winehq.org/data/patterns.html#user32:dialog https://test.winehq.org/data/patterns.html#user32:input https://test.winehq.org/data/patterns.html#user32:monitor https://test.winehq.org/data/patterns.html#user32:win
These all started failing in Wine on 2022-03-17 with the commit below (also referenced in bug 52761):
commit f034084d49b354811096524d472ae5172ac1cebf Author: Eric Pouech eric.pouech@gmail.com Date: Thu Mar 17 08:27:28 2022 +0100
kernelbase: Handle corner case in CreateProcess.
In CreateProcess, if: - parent isn't attached to a console - CreateProcess's flag isn't set with DETACHED_PROCESS nor CREATE_NEW_CONSOLE - child is a CUI program then a console must be allocated for the child.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52048 Signed-off-by: Eric Pouech eric.pouech@gmail.com Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
The way the TestBot starts the tests in Wine is this [1]:
testagentd (Unix, no terminal) - shell script (sh Unix, no terminal) - WineTest.pl (perl Unix, no terminal) - ./wine TestLauncher (Windows CUI, no console) - unit test (Windows CUI) -> creates a console - unit test can recurse upon itself (CUI)
I will now try to summarize the current understanding of the issue from the wine-devel discussion [2], using the above figure as a reference: 1. testagentd is a daemon so it does not have an associated terminal. 2. When ./wine does not have a terminal it does not create a console window, even when starting a console application. This is so wine can be used for background (batch) tasks without requiring a X session or popping up windows all over the place. 3. But when a Windows application calls CreateProcess() without DETACHED_PROCESS, a console does get created. This is what happens when TestLauncher starts a unit test. 4. While the console object is created synchronously in the wineserver process, the actual window is created asynchronously (by wineconsole). This causes it to pop up while the unit test as already started, which confuses the tests that check the window hierarchy, the focus, etc.
There are two ways the above differ from Windows: 1. I believe Windows creates both the console object and the matching window synchronously. So even if the console was created when starting the test unit there should be no failure. 2. On Windows the shell script is replaced by a batch script which triggers the console creation. So the console creation happens a bit earlier which could also mask any window creation delay.
The reason why f034084d49b3 made a difference is that before Wine was not creating console windows.
[1] More details on the different ways the TestBot starts the tests: https://www.winehq.org/pipermail/wine-devel/2022-April/212550.html
[2] March: https://www.winehq.org/pipermail/wine-devel/2022-March/212330.html April: https://www.winehq.org/pipermail/wine-devel/2022-April/212513.html