Closed
Description
Windows Terminal version
1.15.2002.0
Windows build number
10.0.19044.0
Other Software
No response
Steps to reproduce
#include <stdio.h>
#include <windows.h>
int main() {
DWORD initial_mode = 0;
HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
if (!GetConsoleMode(in, &initial_mode)) {
puts("GetConsoleMode failed");
return 1;
}
printf("0x%x\n", initial_mode);
if (!SetConsoleMode(in, -1)) {
puts("SetConsoleMode failed");
};
DWORD new_mode = 0;
if (!GetConsoleMode(in, &new_mode)) {
puts("GetConsoleMode failed");
return 1;
}
printf("0x%x\n", new_mode);
return new_mode != initial_mode;
}
Expected Behavior
Trying to set the console mode to an invalid value should fail and not change it.
Actual Behavior
Setting the console mode with an unsupported flag reports failure but still sets it.
This is unfortunate as it will cause all subsequent calls to SetConsoleMode
with a value from GetConsoleMode
to report failure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment