Created
March 2, 2020 09:16
-
-
Save notfood/5e215e0d42b4abe913ccfdbd419f2aae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/BepInEx/ConsoleUtil/Kon.cs b/BepInEx/ConsoleUtil/Kon.cs | |
index 6166ea9..4f94237 100644 | |
--- a/BepInEx/ConsoleUtil/Kon.cs | |
+++ b/BepInEx/ConsoleUtil/Kon.cs | |
@@ -64,20 +64,23 @@ namespace BepInEx.ConsoleUtil | |
succeeded = false; | |
if (!(conOut == INVALID_HANDLE_VALUE)) | |
{ | |
- CONSOLE_SCREEN_BUFFER_INFO console_SCREEN_BUFFER_INFO; | |
- if (!GetConsoleScreenBufferInfo(conOut, out console_SCREEN_BUFFER_INFO)) | |
- { | |
- bool consoleScreenBufferInfo = GetConsoleScreenBufferInfo(GetStdHandle(-12), out console_SCREEN_BUFFER_INFO); | |
- if (!consoleScreenBufferInfo) | |
- consoleScreenBufferInfo = GetConsoleScreenBufferInfo(GetStdHandle(-10), out console_SCREEN_BUFFER_INFO); | |
- | |
- if (!consoleScreenBufferInfo) | |
- if (Marshal.GetLastWin32Error() == 6 && !throwOnNoConsole) | |
- return default(CONSOLE_SCREEN_BUFFER_INFO); | |
- } | |
- | |
- succeeded = true; | |
- return console_SCREEN_BUFFER_INFO; | |
+ try { | |
+ CONSOLE_SCREEN_BUFFER_INFO console_SCREEN_BUFFER_INFO; | |
+ if (!GetConsoleScreenBufferInfo(conOut, out console_SCREEN_BUFFER_INFO)) { | |
+ bool consoleScreenBufferInfo = GetConsoleScreenBufferInfo(GetStdHandle(-12), out console_SCREEN_BUFFER_INFO); | |
+ if (!consoleScreenBufferInfo) | |
+ consoleScreenBufferInfo = GetConsoleScreenBufferInfo(GetStdHandle(-10), out console_SCREEN_BUFFER_INFO); | |
+ | |
+ if (!consoleScreenBufferInfo) | |
+ if (Marshal.GetLastWin32Error() == 6 && !throwOnNoConsole) | |
+ return default(CONSOLE_SCREEN_BUFFER_INFO); | |
+ | |
+ succeeded = true; | |
+ return console_SCREEN_BUFFER_INFO; | |
+ } | |
+ } catch (EntryPointNotFoundException e) { | |
+ | |
+ } | |
} | |
if (!throwOnNoConsole) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment