[Bug 40482] New: Support set title in start, needed by latest MSYS2
https://bugs.winehq.org/show_bug.cgi?id=40482 Bug ID: 40482 Summary: Support set title in start, needed by latest MSYS2 Product: Wine Version: 1.9.8 Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P2 Component: programs Assignee: wine-bugs(a)winehq.org Reporter: fracting(a)gmail.com Distribution: --- Windows cmd start supports the below syntax: start "this is title" cmd A new cmd window will be created and the title will be set to "this is title". Wine does not support this syntax, cause latest MSYS2 fails. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 Austin English <austinenglish(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish(a)gmail.com Keywords| |download -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 winetest(a)luukku.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest(a)luukku.com --- Comment #1 from winetest(a)luukku.com --- Do you have any patch for this? Would think that adding this feature isn't so hard. What I find more complicated is the location where to start digging wine code. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 Andreas Gnau <Rondom(a)Rondom.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Rondom(a)Rondom.de --- Comment #2 from Andreas Gnau <Rondom(a)Rondom.de> --- It's in /programs/start/start.c http://source.winehq.org/git/wine.git/blob/9e0971e374c87472af00df50a57dc8de7... -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 --- Comment #3 from winetest(a)luukku.com --- Still valid wine 2.8-git. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 Ruslan Kabatsayev <b7.10110111(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |b7.10110111(a)gmail.com --- Comment #4 from Ruslan Kabatsayev <b7.10110111(a)gmail.com> --- Actually the code handling the title argument is there, but it's wrong. The wmain() arguments, argv[], are already stripped from the quotes (unlike cmdLine parameter of wWinMain), while the program looks for '"' as starting character of the title. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 --- Comment #5 from Nikolay Sivov <bunglehead(a)gmail.com> --- I don't think it's a start.exe issue, cmd.exe itself has some logic to parse "start" command arguments to extract title, and then quote is back to pass to start.exe. This is likely where things break. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 Damjan Jovanovic <damjan.jov(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |damjan.jov(a)gmail.com Keywords| |source --- Comment #6 from Damjan Jovanovic <damjan.jov(a)gmail.com> --- Some notes from going through the code, of what I think happens: ---PARENT PROCESS--- 1. The "start" command must be called in the form: wine start "\"title\"" cmd (The cmd tool has its own long complicated way of starting child processes with custom titles, in function WCMD_start() in file programs/cmd/builtins.c, but I don't think we're there yet, we're only in "start" for now.) "start" populates the title into STARTUPINFOW.lpTitle and passes this to... 1.1 CreateProcessW() just calls CreateProcessInternalW(). 1.1.1 CreateProcessInternalW() passes the STARTUPINFOW to create_process_params() 1.1.1.1 create_process_params() passes it to 1.1.1.1.1 RtlCreateProcessParametersEx() which saves it in RTL_USER_PROCESS_PARAMETERS. 1.1.1.2 create_process_params() returns the RTL_USER_PROCESS_PARAMETERS. 1.1.2 CreateProcessInternalW() will then encounter type BINARY_PE and call create_process() passing it the RTL_USER_PROCESS_PARAMETERS. 1.1.2.1 create_process() will call create_startup_info(). 1.1.2.1.1 create_startup_info() converts RTL_USER_PROCESS_PARAMETERS into a startup_info_t. 1.1.2.2 create_process() calls wineserver's "new_process" function, passing it the startup_info_t. 1.1.2.2.1 wineserver stores a copy of it. ... ---PARENT PROCESS--- (OTHER THINGS HAPPEN) ---CHILD PROCESS--- 1. Somehow, ntdll/loader.c __wine_process_init() gets called. 1.1 __wine_process_init calls thread_init(). 1.1.1 thread_init() calls init_user_process_params(). 1.1.1.1 init_user_process_params() calls wineserver's "get_startup_info" function, retrieving the startup_info_t set by the parent. 1.1.1.2 init_user_process_params() converts it to RTL_USER_PROCESS_PARAMETERS and saves it into NtCurrentTeb()->Peb->ProcessParameters. 2. Somehow, process_attach() in kernel32.dll gets called. 2.1 It calls ENV_CopyStartupInformation(), which converts NtCurrentTeb()->Peb->ProcessParameters into a static global variable startup_infoW of type STARTUPINFOW. 3. The child process can call GetStartupInfoW() in KERNEL32.DLL, to retrieve a copy of startup_infoW. ---CHILD PROCESS--- That suggests patching cmd to call GetStartupInfoW() and then just call: SetConsoleTitleW(startupInfoW.lpTitle); should fix this bug. Unfortunately that doesn't work, as the lpTitle returned from GetStartupInfoW() is NULL. Where does it get lost? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 --- Comment #7 from Damjan Jovanovic <damjan.jov(a)gmail.com> --- Created attachment 64894 --> https://bugs.winehq.org/attachment.cgi?id=64894 start cmd with CreateProcessW() instead of ShellExecuteEx() The problem is that Wine's start.exe uses ShellExecuteExW() to launch the program, which doesn't have a way to specify the title, so the passed title is just ignored. If I hack it to use CreateProcessW() instead, as per the attached patch, and run: wine start "\"hello\"" \\Windows\\system32\\cmd.exe (note that a leading C: breaks it) then the wineconsole windows gets a title of "hello". start.exe clearly needs considerable improvement. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 --- Comment #8 from Damjan Jovanovic <damjan.jov(a)gmail.com> --- (In reply to Damjan Jovanovic from comment #7)
If I hack it to use CreateProcessW() instead, as per the attached patch, and run:
wine start "\"hello\"" \\Windows\\system32\\cmd.exe
(note that a leading C: breaks it) then the wineconsole windows gets a title of "hello".
start.exe clearly needs considerable improvement.
This also needed programs/cmd patched to show the title. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 --- Comment #9 from Damjan Jovanovic <damjan.jov(a)gmail.com> --- Commits 6ae919de8112483c3e4c1b0cd69e0de6f084d038..42fa293d48be89ce06b1aab264c5c0d8cc1b4f53 fixed multiple problems in handling the title in start.exe/cmd.exe. Can someone please retest? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 Anastasius Focht <focht(a)gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |42fa293d48be89ce06b1aab264c | |5c0d8cc1b4f53 Keywords|download, source | CC| |focht(a)gmx.net Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #10 from Anastasius Focht <focht(a)gmx.net> --- Hello folks, resolving fixed here. * https://source.winehq.org/git/wine.git/commitdiff/ada8b1ab9387f0ee2a6b96ce7c... ("cmd.exe: If there is a title given through STARTUPINFO, use it.") * https://source.winehq.org/git/wine.git/commitdiff/f2fa7ec3c57dc79fab755f6a0e... ("start.exe: Pass the "show window" flags to CreateProcess() too.") * https://source.winehq.org/git/wine.git/commitdiff/3c7501e8f0f941db012bed16cf... ("start.exe: Launch all binaries through CreateProcess().") * https://source.winehq.org/git/wine.git/commitdiff/42fa293d48be89ce06b1aab264... ("start.exe: Search PATH for the executable to launch.") * https://source.winehq.org/git/wine.git/commitdiff/c5bceecb51efc52b315b3526d9... ("start.exe: STARTUPINFOW needs the STARTF_USESHOWWINDOW flag.") -> regression fix for 42fa293d48be89ce06b1aab264c5c0d8cc1b4f53 Thanks Damjan --- snip --- $ wine start "\"hello there\"" \\Windows\\system32\\cmd.exe --- snip --- works as expected with Wine 4.21 while it doesn't with older versions: --- snip --- $ wine start "\"hello there\"" \\Windows\\system32\\cmd.exe fixme:exec:SHELL_execute flags ignored: 0x00000100 Application could not be started, or no application associated with the specified file. ShellExecuteEx failed: Path not found. --- snip -- Removing 'download' and 'source' keywords. They are not useful if you don't provide the information in the bug ticket fields or at least in the comments (direct links to downloads and MSYS2 source references). Always specify the application version to be able to reproduce even years later. $ wine --version wine-5.0-rc6 Regards -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=40482 Alexandre Julliard <julliard(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #11 from Alexandre Julliard <julliard(a)winehq.org> --- Closing bugs fixed in 5.1. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (2)
-
wine-bugs@winehq.org -
WineHQ Bugzilla