1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-14 05:25:06 -05:00

sockfilt.c: ignore non-key-events and continue waiting for input

This commit is contained in:
Marc Hoersken 2014-04-20 18:26:24 +02:00
parent eb01947e1d
commit fe1c0176c1

View File

@ -515,15 +515,24 @@ static void lograw(unsigned char *buffer, ssize_t len)
*/ */
static DWORD WINAPI select_ws_stdin_wait_thread(LPVOID lpParameter) static DWORD WINAPI select_ws_stdin_wait_thread(LPVOID lpParameter)
{ {
INPUT_RECORD inputrecord;
HANDLE handle; HANDLE handle;
DWORD mode; DWORD length;
handle = (HANDLE) lpParameter; handle = (HANDLE) lpParameter;
if(GetConsoleMode(handle, &mode)) if(GetConsoleMode(handle, &length)) {
WaitForSingleObjectEx(handle, INFINITE, FALSE); while(WaitForSingleObjectEx(handle, INFINITE, FALSE) == WAIT_OBJECT_0) {
if(PeekConsoleInput(handle, &inputrecord, 1, &length)) {
if(length == 1 && inputrecord.EventType != KEY_EVENT)
ReadConsoleInput(handle, &inputrecord, 1, &length);
else
break;
}
}
}
else else
ReadFile(handle, NULL, 0, &mode, NULL); ReadFile(handle, NULL, 0, &length, NULL);
return 0; return 0;
} }