From 0973aeab152146b45ac016c21e94d3e079908ad0 Mon Sep 17 00:00:00 2001 From: Dustin Howett Date: Wed, 10 Aug 2022 23:18:27 +0000 Subject: [PATCH] Merged PR 7705347: Add stubs to Terminal for OneCoreSafe*, fix the ConIoSrv header This is required for us to build out of the Terminal repo. Related work items: MSFT-40435912 --- dep/Console/ConIoSrv.h | 20 ++++++++++++++++++++ src/cascadia/TerminalCore/Terminal.cpp | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/dep/Console/ConIoSrv.h b/dep/Console/ConIoSrv.h index 17fdd9976a..1c8528a7b8 100644 --- a/dep/Console/ConIoSrv.h +++ b/dep/Console/ConIoSrv.h @@ -13,6 +13,10 @@ Licensed under the MIT license. #define CIS_EVENT_TYPE_FOCUS (1) #define CIS_EVENT_TYPE_FOCUS_ACK (2) +#define CIS_MSG_TYPE_MAPVIRTUALKEY (0) +#define CIS_MSG_TYPE_VKKEYSCAN (1) +#define CIS_MSG_TYPE_GETKEYSTATE (2) + #define CIS_MSG_TYPE_GETDISPLAYSIZE (3) #define CIS_MSG_TYPE_GETFONTSIZE (4) #define CIS_MSG_TYPE_SETCURSOR (5) @@ -31,6 +35,22 @@ typedef struct { UCHAR Type; union { + struct { + UINT Code; + UINT MapType; + UINT ReturnValue; + } MapVirtualKeyParams; + + struct { + WCHAR Character; + SHORT ReturnValue; + } VkKeyScanParams; + + struct { + int VirtualKey; + SHORT ReturnValue; + } GetKeyStateParams; + struct { CD_IO_DISPLAY_SIZE DisplaySize; diff --git a/src/cascadia/TerminalCore/Terminal.cpp b/src/cascadia/TerminalCore/Terminal.cpp index fe63670a6a..a366c614c8 100644 --- a/src/cascadia/TerminalCore/Terminal.cpp +++ b/src/cascadia/TerminalCore/Terminal.cpp @@ -1613,3 +1613,23 @@ til::color Terminal::GetColorForMark(const Microsoft::Console::VirtualTerminal:: } } } + +// These functions are used by TerminalInput, which must build in conhost +// against OneCore compatible signatures. See the definitions in +// VtApiRedirection.hpp (which we cannot include cross-project.) +// Since we do nto run on OneCore, we can dispense with the compatibility +// shims. +extern "C" UINT OneCoreSafeMapVirtualKeyW(_In_ UINT uCode, _In_ UINT uMapType) +{ + return MapVirtualKeyW(uCode, uMapType); +} + +extern "C" SHORT OneCoreSafeVkKeyScanW(_In_ WCHAR ch) +{ + return VkKeyScanW(ch); +} + +extern "C" SHORT OneCoreSafeGetKeyState(_In_ int nVirtKey) +{ + return GetKeyState(nVirtKey); +}