steam_helper: Add PROTON_HIDE_PROCESS_WINDOW for hiding the child process's window

CW-Bug-Id: #15930
This commit is contained in:
Andrew Eikum 2021-10-27 10:13:46 -05:00 committed by Arkadiusz Hiler
parent f2ff463c08
commit 5b7de85bdf

View file

@ -880,6 +880,7 @@ static HANDLE run_process(BOOL *should_await)
PROCESS_INFORMATION pi;
DWORD flags = CREATE_UNICODE_ENVIRONMENT;
BOOL use_shell_execute = TRUE;
BOOL hide_window;
/* skip argv[0] */
if (*cmdline == '"')
@ -985,6 +986,7 @@ run:
SetConsoleCtrlHandler( console_ctrl_handler, TRUE );
use_shell_execute = should_use_shell_execute(cmdline);
hide_window = env_nonzero("PROTON_HIDE_PROCESS_WINDOW");
/* only await the process finishing if we launch a process directly...
* Steam simply calls ShellExecuteA with the same parameters.
@ -998,12 +1000,18 @@ run:
if (use_shell_execute)
{
static const WCHAR verb[] = { 'o', 'p', 'e', 'n', 0 };
ShellExecuteW(NULL, verb, cmdline, NULL, NULL, SW_SHOWNORMAL);
ShellExecuteW(NULL, verb, cmdline, NULL, NULL, hide_window ? SW_HIDE : SW_SHOWNORMAL);
return INVALID_HANDLE_VALUE;
}
else
{
if (hide_window)
{
si.dwFlags |= STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
}
if (!CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, flags, NULL, NULL, &si, &pi))
{
WINE_ERR("Failed to create process %s: %u\n", wine_dbgstr_w(cmdline), GetLastError());