From beae9cad31bf38540c984e2e3dec925f20d07cb4 Mon Sep 17 00:00:00 2001 From: bagajjal Date: Fri, 20 Oct 2017 10:21:17 -0700 Subject: [PATCH] fix#902 and scp x86 debug build error --- contrib/win32/openssh/scp.vcxproj | 1 + contrib/win32/win32compat/tncon.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/contrib/win32/openssh/scp.vcxproj b/contrib/win32/openssh/scp.vcxproj index 6df3a7663..fe41a4e93 100644 --- a/contrib/win32/openssh/scp.vcxproj +++ b/contrib/win32/openssh/scp.vcxproj @@ -114,6 +114,7 @@ $(SolutionDir);$(LibreSSL-Path)include;$(OpenSSH-Src-Path)includes;$(OpenSSH-Src-Path);$(OpenSSH-Src-Path)contrib\win32\win32compat;$(OpenSSH-Src-Path)libkrb;$(OpenSSH-Src-Path)libkrb\libKrb5;%(AdditionalIncludeDirectories) MultiThreadedDebug Guard + ProgramDatabase Console diff --git a/contrib/win32/win32compat/tncon.c b/contrib/win32/win32compat/tncon.c index ce0be0492..52287947a 100644 --- a/contrib/win32/win32compat/tncon.c +++ b/contrib/win32/win32compat/tncon.c @@ -131,6 +131,7 @@ ReadConsoleForTermEmul(HANDLE hInput, char *destin, int destinlen) DWORD nHandle = 1; DWORD dwInput = 0; DWORD dwControlKeyState = 0; + DWORD dwAltGrFlags = LEFT_CTRL_PRESSED | RIGHT_ALT_PRESSED; DWORD rc = 0; unsigned char octets[20]; char aChar = 0; @@ -161,6 +162,11 @@ ReadConsoleForTermEmul(HANDLE hInput, char *destin, int destinlen) bShift = (InputRecord.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED); dwControlKeyState = InputRecord.Event.KeyEvent.dwControlKeyState & ~(CAPSLOCK_ON | ENHANCED_KEY | NUMLOCK_ON | SCROLLLOCK_ON); + + /* ignore the AltGr flags*/ + if ((dwControlKeyState & dwAltGrFlags) == dwAltGrFlags) + dwControlKeyState = dwControlKeyState & ~dwAltGrFlags; + modKey = GetModifierKey(dwControlKeyState); if (InputRecord.Event.KeyEvent.bKeyDown) { int n = WideCharToMultiByte(