From c16878b8eef3cb9c7fa14ef30c687b00b66a9d8a Mon Sep 17 00:00:00 2001 From: Meivyn Date: Sat, 3 Apr 2021 03:33:13 -0400 Subject: [PATCH] Use bool instead of uint for better readability --- IPA.Loader/Logging/ConsoleWindow.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/IPA.Loader/Logging/ConsoleWindow.cs b/IPA.Loader/Logging/ConsoleWindow.cs index 178aa44a..9450a1a1 100644 --- a/IPA.Loader/Logging/ConsoleWindow.cs +++ b/IPA.Loader/Logging/ConsoleWindow.cs @@ -26,10 +26,10 @@ namespace IPA.Logging { bool consoleAttached = true; if (alwaysCreateNewConsole - || (AttachConsole(pid) == 0 + || (!AttachConsole(pid) && Marshal.GetLastWin32Error() != ErrorAccessDenied)) { - consoleAttached = AllocConsole() != 0; + consoleAttached = AllocConsole(); } if (consoleAttached) @@ -112,14 +112,14 @@ namespace IPA.Logging SetLastError = true, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - private static extern int AllocConsole(); + private static extern bool AllocConsole(); [DllImport("kernel32.dll", EntryPoint = "AttachConsole", SetLastError = true, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - private static extern uint AttachConsole(uint dwProcessId); + private static extern bool AttachConsole(uint dwProcessId); [DllImport("kernel32.dll", EntryPoint = "CreateFileW",