From 840e25a11b522e832719b7967a2ede6f05d40731 Mon Sep 17 00:00:00 2001 From: Meivyn <793322+Meivyn@users.noreply.github.com> Date: Mon, 20 Feb 2023 04:28:26 -0500 Subject: [PATCH] Fix some issues with console initialization --- IPA.Loader/Logging/ConsoleWindow.cs | 6 ++---- docs/articles/command-line.md | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/IPA.Loader/Logging/ConsoleWindow.cs b/IPA.Loader/Logging/ConsoleWindow.cs index 2b6fd020..5dbc7462 100644 --- a/IPA.Loader/Logging/ConsoleWindow.cs +++ b/IPA.Loader/Logging/ConsoleWindow.cs @@ -24,10 +24,8 @@ namespace IPA.Logging public static void Initialize(int processId, bool alwaysCreateNewConsole = false) { - bool consoleAttached = true; - if (alwaysCreateNewConsole - || (!AttachConsole(processId) - && Marshal.GetLastWin32Error() != ErrorAccessDenied)) + bool consoleAttached; + if (alwaysCreateNewConsole || !(consoleAttached = AttachConsole(processId))) { consoleAttached = AllocConsole(); } diff --git a/docs/articles/command-line.md b/docs/articles/command-line.md index be94ab21..019e50cc 100644 --- a/docs/articles/command-line.md +++ b/docs/articles/command-line.md @@ -40,6 +40,9 @@ Here's a quick list of what they are and what they do. > ```powershell > powershell -c ".\steam -applaunch 620980 --verbose (Get-CimInstance Win32_Process -Filter ProcessId=$PID).ParentProcessId" > ``` + > + > Do note that this isn't going to work from an elevated terminal. + - `--debug`