Commit db65e4f5 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fixes for Windows XP

parent bfac7d63
......@@ -62,12 +62,13 @@
/* were just going to fake it here and get input from the keyboard */
void get_tty_password_buff(const char *opt_message, char *to, size_t length)
{
HANDLE consoleinput;
HANDLE consoleinput;
DWORD oldstate;
char *pos=to,*end=to+length-1;
int i=0;
consoleinput= CreateFile("CONIN$", GENERIC_WRITE | GENERIC_READ, 0 , NULL, 0, 0, NULL);
consoleinput= CreateFile("CONIN$", GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ ,
NULL, OPEN_EXISTING, 0, NULL);
if (consoleinput == NULL || consoleinput == INVALID_HANDLE_VALUE)
{
/* This is a GUI application or service without console input, bail out. */
......@@ -76,11 +77,11 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length)
}
_cputs(opt_message ? opt_message : "Enter password: ");
/*
Switch to raw mode (no line input, no echo input).
Allow Ctrl-C handler with ENABLE_PROCESSED_INPUT.
*/
GetConsoleMode(consoleinput, &oldstate);
/*
Switch to raw mode (no line input, no echo input).
Allow Ctrl-C handler with ENABLE_PROCESSED_INPUT.
*/
GetConsoleMode(consoleinput, &oldstate);
SetConsoleMode(consoleinput, ENABLE_PROCESSED_INPUT);
for (;;)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment