From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 391C121AE30DB for ; Sun, 9 Sep 2018 18:20:12 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Sep 2018 18:20:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,353,1531810800"; d="scan'208";a="89041229" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 09 Sep 2018 18:19:44 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 9 Sep 2018 18:19:44 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 9 Sep 2018 18:19:44 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.143]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.240]) with mapi id 14.03.0319.002; Mon, 10 Sep 2018 09:19:42 +0800 From: "Wu, Hao A" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Kinney, Michael D" Thread-Topic: [PATCH v2] Emulator/Win: Fix build failure using VS2015x86 or old WinSDK Thread-Index: AQHURm5YKAFd9CLtpEKmZ9V6frVdRaTou8UA Date: Mon, 10 Sep 2018 01:19:41 +0000 Message-ID: References: <20180907054828.28240-1-ruiyu.ni@intel.com> In-Reply-To: <20180907054828.28240-1-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2] Emulator/Win: Fix build failure using VS2015x86 or old WinSDK X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Sep 2018 01:20:13 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Hao Wu Best Regards, Hao Wu > -----Original Message----- > From: Ni, Ruiyu > Sent: Friday, September 07, 2018 1:48 PM > To: edk2-devel@lists.01.org > Cc: Kinney, Michael D; Wu, Hao A > Subject: [PATCH v2] Emulator/Win: Fix build failure using VS2015x86 or ol= d > WinSDK >=20 > When build with WinSDK <=3D Win10 TH2, the terminal over CMD.exe > doesn't work. Because Win10 later than TH2 starts to support VT > terminal. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Michael D Kinney > Cc: Hao A Wu > --- > EmulatorPkg/Win/Host/WinHost.c | 2 +- > EmulatorPkg/Win/Host/WinThunk.c | 23 ++++++++++++++++------- > 2 files changed, 17 insertions(+), 8 deletions(-) >=20 > diff --git a/EmulatorPkg/Win/Host/WinHost.c > b/EmulatorPkg/Win/Host/WinHost.c > index 9b98d5330f..65e8960eff 100644 > --- a/EmulatorPkg/Win/Host/WinHost.c > +++ b/EmulatorPkg/Win/Host/WinHost.c > @@ -673,7 +673,7 @@ Returns: > // Transfer control to the SEC Core > // > SwitchStack ( > - (SWITCH_STACK_ENTRY_POINT)SecCoreEntryPoint, > + (SWITCH_STACK_ENTRY_POINT)(UINTN)SecCoreEntryPoint, > SecCoreData, > GetThunkPpiList (), > TopOfStack > diff --git a/EmulatorPkg/Win/Host/WinThunk.c > b/EmulatorPkg/Win/Host/WinThunk.c > index 306fe75ecd..6007db73b5 100644 > --- a/EmulatorPkg/Win/Host/WinThunk.c > +++ b/EmulatorPkg/Win/Host/WinThunk.c > @@ -71,15 +71,23 @@ SecConfigStdIn ( > // > // Disable buffer (line input), echo, mouse, window > // > - Success =3D SetConsoleMode ( > - GetStdHandle (STD_INPUT_HANDLE), > - Mode | ENABLE_VIRTUAL_TERMINAL_INPUT & > ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT | > ENABLE_WINDOW_INPUT) > - ); > - } > - if (Success) { > + Mode &=3D ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | > ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT); > + > +#if defined(NTDDI_VERSION) && defined (NTDDI_WIN10_TH2) && > (NTDDI_VERSION > NTDDI_WIN10_TH2) > // > - // Enable terminal mode > + // Enable virtual terminal input for Win10 above TH2 > // > + Mode |=3D ENABLE_VIRTUAL_TERMINAL_INPUT; > +#endif > + > + Success =3D SetConsoleMode (GetStdHandle (STD_INPUT_HANDLE), Mode); > + } > + > +#if defined(NTDDI_VERSION) && defined (NTDDI_WIN10_TH2) && > (NTDDI_VERSION > NTDDI_WIN10_TH2) > + // > + // Enable terminal mode for Win10 above TH2 > + // > + if (Success) { > Success =3D GetConsoleMode (GetStdHandle (STD_OUTPUT_HANDLE), > &Mode); > if (Success) { > Success =3D SetConsoleMode ( > @@ -88,6 +96,7 @@ SecConfigStdIn ( > ); > } > } > +#endif > return Success ? EFI_SUCCESS : EFI_DEVICE_ERROR; > } >=20 > -- > 2.16.1.windows.1