From 81bf1c55b17a8188370009d6bfa51a398285898a Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 6 Jul 2023 15:30:36 +0300 Subject: [PATCH] Add comment about `GetConsoleMode`'s return value --- src/control.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/control.rs b/src/control.rs index b1618ec..4ab6532 100644 --- a/src/control.rs +++ b/src/control.rs @@ -41,7 +41,10 @@ pub fn set_virtual_terminal(use_virtual: bool) -> Result<(), ()> { } let mut original_mode: DWORD = 0; + // Return value of 0 means that the function failed: + // https://learn.microsoft.com/en-us/windows/console/getconsolemode#return-value if GetConsoleMode(handle, &mut original_mode) == 0 { + // TODO: It would be prudent to get the error using `GetLastError` here. return Err(()); }