diff options
-rw-r--r-- | crypto/compat/ui_openssl_win.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/crypto/compat/ui_openssl_win.c b/crypto/compat/ui_openssl_win.c index ecf7376..6597c6a 100644 --- a/crypto/compat/ui_openssl_win.c +++ b/crypto/compat/ui_openssl_win.c | |||
@@ -133,6 +133,7 @@ | |||
133 | /* Define globals. They are protected by a lock */ | 133 | /* Define globals. They are protected by a lock */ |
134 | static void (*savsig[NX509_SIG])(int ); | 134 | static void (*savsig[NX509_SIG])(int ); |
135 | 135 | ||
136 | DWORD console_mode; | ||
136 | static FILE *tty_in, *tty_out; | 137 | static FILE *tty_in, *tty_out; |
137 | static int is_a_tty; | 138 | static int is_a_tty; |
138 | 139 | ||
@@ -300,28 +301,27 @@ open_console(UI *ui) | |||
300 | tty_in = stdin; | 301 | tty_in = stdin; |
301 | tty_out = stderr; | 302 | tty_out = stderr; |
302 | 303 | ||
303 | return 1; | 304 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); |
305 | if (handle != INVALID_HANDLE_VALUE) | ||
306 | return GetConsoleMode(handle, &console_mode); | ||
307 | return 0; | ||
304 | } | 308 | } |
305 | 309 | ||
306 | static int | 310 | static int |
307 | noecho_console(UI *ui) | 311 | noecho_console(UI *ui) |
308 | { | 312 | { |
309 | DWORD mode = 0; | ||
310 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); | 313 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); |
311 | if (handle != INVALID_HANDLE_VALUE && handle != handle) { | 314 | if (handle != INVALID_HANDLE_VALUE) |
312 | return GetConsoleMode(handle, &mode) && SetConsoleMode(handle, mode & (~ENABLE_ECHO_INPUT)); | 315 | return SetConsoleMode(handle, console_mode & ~ENABLE_ECHO_INPUT); |
313 | } | ||
314 | return 0; | 316 | return 0; |
315 | } | 317 | } |
316 | 318 | ||
317 | static int | 319 | static int |
318 | echo_console(UI *ui) | 320 | echo_console(UI *ui) |
319 | { | 321 | { |
320 | DWORD mode = 0; | ||
321 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); | 322 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); |
322 | if (handle != INVALID_HANDLE_VALUE && handle != handle) { | 323 | if (handle != INVALID_HANDLE_VALUE) |
323 | return GetConsoleMode(handle, &mode) && SetConsoleMode(handle, mode | ENABLE_ECHO_INPUT); | 324 | return SetConsoleMode(handle, console_mode); |
324 | } | ||
325 | return 0; | 325 | return 0; |
326 | } | 326 | } |
327 | 327 | ||