Skip to content

Commit 2a4b75f

Browse files
committed
Fix output logging bug that broke games that run in a Windows console
Since 29f9677 the shim hands every game the shim's std handles with STARTF_USESTDHANDLES, so console APIs fail in a console game. Absolum's Console.Clear() threw IOException: Invalid handle and the game exited before opening a window. Without the flag, an inherited stdout still reaches a windowed game, and a console game's new console replaces all three handles. A detected console game also skips inheritance, matching Proton's steam.cpp.
1 parent 86097bd commit 2a4b75f

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎steam-shim/steam.cpp‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,12 +1475,9 @@ static HANDLE run_process(BOOL *should_await, BOOL game_process)
14751475
si.wShowWindow = SW_HIDE;
14761476
}
14771477

1478-
si.dwFlags |= STARTF_USESTDHANDLES;
1479-
si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
1480-
si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
1481-
si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
1478+
BOOL inherit = !(flags & CREATE_NEW_CONSOLE);
14821479

1483-
if (!CreateProcessW(NULL, cmdline, NULL, NULL, TRUE, flags, NULL, NULL, &si, &pi))
1480+
if (!CreateProcessW(NULL, cmdline, NULL, NULL, inherit, flags, NULL, NULL, &si, &pi))
14841481
{
14851482
WINE_ERR("Failed to create process %s: %u\n", wine_dbgstr_w(cmdline), GetLastError());
14861483
return INVALID_HANDLE_VALUE;

0 commit comments

Comments
 (0)