From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 2D3E6AC1598 for ; Tue, 26 Sep 2023 20:50:46 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=o3lrWWkrU6esSdClAxjsqpHC5b+GVw44rUSU9x/8aRk=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1695761444; v=1; b=MBdHHWyh0UkvKwtE9JqggthF1uYOTrknGLItCewKnvoyzr1+2IUh+RNcTWMNHij8pNifdPVS DI/dWC3vb90PnMSJ3wn5fDsQ9BJXL0cbq29gUYiqBkYYAwJc8FRdHyjqL8rx0uA2WJyuu3dRr1n 7Zz8Vf2bpwws48PU476cAlF8= X-Received: by 127.0.0.2 with SMTP id P3DGYY7687511xikbG0UBv4g; Tue, 26 Sep 2023 13:50:44 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.2441.1695761444103503647 for ; Tue, 26 Sep 2023 13:50:44 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="448160027" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="448160027" X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 13:50:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="864536160" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="864536160" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga002.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 26 Sep 2023 13:50:42 -0700 X-Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Tue, 26 Sep 2023 13:50:42 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Tue, 26 Sep 2023 13:50:42 -0700 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Tue, 26 Sep 2023 13:50:42 -0700 X-Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.177) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Tue, 26 Sep 2023 13:50:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fe70B6LfEeqlEOfzpXCeNaGKqtwUfGecH9ntP52OyC/AMakkciwaQLLxtypscHmcwg8DkfsaIqe+8xhgC9bYfTlZqBXbNLOVne4IMkqYniyHVz97+SvF1vKIbKX0iAUVkcYzop/wDZgnGPgpleT47J1jxhT9ZC6b19i+2SFoSH+JYIftV4fR4/dQjJZys4HBsXgQ5xzS7dt9snfMcrm3i5Y15NC78bjYh/QKaIPIrAAzP0LfY70DjsKPAMMtbmUsq1hLY8u+tNXAyb8CD6fuImpglOqycWih8tO5Z39kZP7tXpahK5rqMekYfbAVuaDhmOUyF4JE6aS+hDbrVCpc7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jpVz9qbq0OJA904+mqQ41XtZeQvN8pBn7snVACEVD9U=; b=G2k81fYRiRuDeYKGUrx82nl2bWgsHDCVHhYTKOpT/OqIlYAhxhhHmk0eFTrPRR2AFXC0H6RHu0ie8+c3ZvK72d1PQ7V/kILSR0hhL026tadC3vcnwkCCqBXhS3/tT8yG7TXW8cYgPJYuuKSNzb2oCGg0W3fmAUh/8MOyiITWrhXWvMdJNUlZjwWMHgsul9vhokg+K0iZ3mpXXpmHkrmwXfyxNrjKq7MPG+mZcVYp3DoiH0IK8g/6k28qDfZCPd/smr8caa6CKG9uMLW5XFmDCVO9AlXB8QsG0IbYewTl1txwJ0Vuez9vl2IKH4UlPPt6e97KoV9OaG7LPu5QYCjwPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from MW4PR11MB5821.namprd11.prod.outlook.com (2603:10b6:303:184::5) by PH7PR11MB8453.namprd11.prod.outlook.com (2603:10b6:510:308::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.23; Tue, 26 Sep 2023 20:50:33 +0000 X-Received: from MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::89db:ecf0:29f5:9f3c]) by MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::89db:ecf0:29f5:9f3c%4]) with mapi id 15.20.6813.017; Tue, 26 Sep 2023 20:50:33 +0000 From: "Nate DeSimone" To: "Kinney, Michael D" , "devel@edk2.groups.io" CC: Andrew Fish , "Ni, Ray" , "Chiu, Chasel" Subject: Re: [edk2-devel] [PATCH v1] EmulatorPkg: Fix Terminal Issues Thread-Topic: [PATCH v1] EmulatorPkg: Fix Terminal Issues Thread-Index: AQHZ8KhcA9l2MMuSy0C673hGdEk4+rAth0pwgAAJYYCAAADRwIAAAtQg Date: Tue, 26 Sep 2023 20:50:33 +0000 Message-ID: References: <20230926183601.2974-1-nathaniel.l.desimone@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR11MB5821:EE_|PH7PR11MB8453:EE_ x-ms-office365-filtering-correlation-id: c5c64e7e-b341-48f7-e08a-08dbbed23a38 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: LQ+aSRt7Oss37yHDMWgEFb5e60H84pvLlk3QGKlAxia1fCsWcZN6aBS8l8XFPrz4UNRfcnbxUc8CvOo7/Qh5VhWKsLBT1ceoS129B2dHMC7SMYhAjWSKcuqGb243HpdzlOJtDceLN9ZDBoiIjTnOKBvBUr+n9li0oje4o/Um/PQTeRhA7kb0iMugkMyXH3ohyJNrg4AZTcaHCvnU0CXn9A2yKsRs11kt6hbdOWVGsHDM94GKzaJMaqYOcfHrgdzxbe+WG8P43RQ07zaiPnVZU8eZ1wyMUo5jcl2MIR1QEIlQsqg/W8OTatWlkJVSVeaGsk3ccxgdBGiHpZxXlRUioYJIGl/Jqz1BElXJSj3llJD3ym7AW1dIfhktmx8E/24K4kzudOhzP5w4CuEyn7ZoIjDVz7JwFLwW2mgDO1SvVZXy4qWZ+qS8u6dIHzh2RLaHSUnKnyPtmssq5qJiNiQttbSiebXTk0FwCKCBcA8CFMe+9vKMR7ibIqXpiXlvoF5v+H/D8kZ99hW0C/ZBKRwOLjDNy0iY1CRBsMZ6T294q0dWh3+dtaJTz5TRnxTZZuB0miyH1+2OqmbdjK8n++xCUD8pxrcgDYaGHi5W9ttkNJzFszdRV3BsyyUggE0qEJdP x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?P731nY7AloGIMj43WdrNEgbeFqKtVEGvYWdsgI309UNwxYAMpdtvJ+UpRqnE?= =?us-ascii?Q?lHtqC1ajMb5D9JlBJG0vpUur3I+mJoqJYEHXFaNs04+PqBPR9GmhrMWXYFLS?= =?us-ascii?Q?9SGwIkWzHBkQ1W0c7wLhaFORUTkb75W6JuT18QCx1ohffyNzRRiLfLsl20v6?= =?us-ascii?Q?6mkBgrEGLAYZq+3jCU9eEUu3vqJdb22OfAua/6MPDTWqKG+hep9xMgS4DfHa?= =?us-ascii?Q?hRgD1c0QSRfN5fdj/VlXFG52/gA6Yy7Fqo84cGGcP0ixXwS1zxzMQMGMizzn?= =?us-ascii?Q?AjhBEK+z0USzeUUyrY/o3yDBEjFCKFdr9qZPcHGmN4sf5KhnlJiM9VtB9Aov?= =?us-ascii?Q?BG6k4Szdf9sLfgPzPhJ8UPST8zbU6jyF/0WR2wvo+0KGJqHD3O/1N0lwynsO?= =?us-ascii?Q?pNp+DPMvulqG6ucqkriIyCgRtQW0EEFOT1HWtN1FMuxNBbpMqA2+MIbDNjvg?= =?us-ascii?Q?eXaZfq2YEaihb0AD/JFBYM89G4HLkJmr7kMzaoyh/pVLStg9Uj3WFmaSYJWC?= =?us-ascii?Q?pHpVNqRllI2zOZzOsau5r18OAfWUW+aLRasJVe8k2jRx8DDLDAiDqMA6me4n?= =?us-ascii?Q?+BRsSFipp32u5uk2btBxD+sRixM8J6/sZIYO8WFkC1c0e8clEj4mkhGW9b75?= =?us-ascii?Q?Lv7n8DnRE7lgH8OzE4kwZS2FfG1pluHh060qSqiaiTPVwz/cmOtCexMNQ2da?= =?us-ascii?Q?+kxzgd9ki7a7xFhqL8s13grNjq/DDzMf5qt2ru80XGBAqhHFVGW5r/C8wnmu?= =?us-ascii?Q?Ioi4jeDAp3Cmn0rlpw/pW6L87DRYRI/at4+0lM2Fl69khrY3ekhPn3S0m5/G?= =?us-ascii?Q?3FAkoycVpIBtpbXrFQimzl64MOaCvKgZRvtndtOueyN1wrqk0pi3v2dvOsMl?= =?us-ascii?Q?b05YtcITxEGqs7Qc1nEK+MK7dtiXQb1QwVFxjF7QA//QQfoLjkcNVNxDIki9?= =?us-ascii?Q?7Cm5nZw7yiSyogCLfsiFLxIZl6k/lyBaWUUNeLW8CjpugS1Rn2HOuCvBGMGT?= =?us-ascii?Q?ex55TjfGxLmwl1dQLZDhY0Hj8+FDxq7dUGBPBVgFJ3eNhqh4Yk+wx+Xbrcst?= =?us-ascii?Q?BtJVPdBBmPG0g74s+56qRplwNGMOXgCfDfuF1+Y6MXGDWt0KA8f4I6DdaOVn?= =?us-ascii?Q?jMaT5kLxZJs+hrLnkfcsCLZ9pjU+JL4Rkk4B8tZo+1lAJfkWfM9QU4jxS9f/?= =?us-ascii?Q?sdZl+09YZ9Y87X7JARuR03vAGXuR+6GvkvzB+I0T1cWpzwhv0AvR8vqNVGuN?= =?us-ascii?Q?48Zi16tXygG3DxNkOLOeTXyd+m1U5PN0p8OwS8oEpEVWW8Hn4tCHrfZcyAGN?= =?us-ascii?Q?ZtpFRjDsdfRvDqnherC5pDs7ATq/kegPSI3gzL1L6qJsneV/W9Uk4rXw1bBA?= =?us-ascii?Q?dOBwCnaJJyyUcjG9d2Xmd+QovP4orqzzB7tPej4RhBkjm5b9D6Dd8/YIypVw?= =?us-ascii?Q?WRO1ohHKmZ2yZXW0P+mUVLjP1Sdgorhp3hgpKLk90b0CxNHG8YhwlZioGqQo?= =?us-ascii?Q?3g4UN1/ASc0Xcy1SI6/yD9HE0MVbLCCQyAIhKzlQQ0aPreMiyQrwKBUqO6un?= =?us-ascii?Q?TFBuHSsqer7Ub6VgVhnH5D9Ni5Lc+/TrXMOc07TUnnTiz5xbB3Dh64MPYGzR?= =?us-ascii?Q?0A=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5821.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5c64e7e-b341-48f7-e08a-08dbbed23a38 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Sep 2023 20:50:33.2179 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 7CX71PGiDbbmYdTXtO0aiCX72IzVyqSD26nG6DyZi4auSPbEKMZ18ctbs55xTSWS/Mie1PU100uSY1TAOEZoNw3rW1uTad4ks57xK7VoagU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB8453 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nathaniel.l.desimone@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: L9mN66KTtxBab3uBl6vHDpgSx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=MBdHHWyh; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:dns request to arcselector9901._domainkey.microsoft.com failed: no records with this name}"); dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Looks like it compiles fine in VS2015, and we just removed the tools_def en= tries for every VC++ version older than that. And C99 has been in gcc for a= very long time and clang forever. So perhaps we can start using C99 style = variable declarations finally? Thanks, Nate -----Original Message----- From: Desimone, Nathaniel L=20 Sent: Tuesday, September 26, 2023 1:39 PM To: Kinney, Michael D ; devel@edk2.groups.io Cc: Andrew Fish ; Ni, Ray ; Chiu, Chasel= Subject: RE: [PATCH v1] EmulatorPkg: Fix Terminal Issues Oh, never mind, I see you are suggesting a C99 style variable declaration. = Do we need to worry about old compiler that want all variable declarations = at the top still? Thanks, Nate -----Original Message----- From: Desimone, Nathaniel L Sent: Tuesday, September 26, 2023 1:38 PM To: Kinney, Michael D ; devel@edk2.groups.io Cc: Andrew Fish ; Ni, Ray ; Chiu, Chasel= Subject: RE: [PATCH v1] EmulatorPkg: Fix Terminal Issues Hi Mike, Unfortunately, that change will generate the following warning on GCC4.6+ warning: variable "Success" set but not used [-Wunused-but-set-variable] Hence why I wrote it that way. Let me know if you would like me to make a d= ifferent change before committing. Thanks, Nate -----Original Message----- From: Kinney, Michael D Sent: Tuesday, September 26, 2023 1:03 PM To: Desimone, Nathaniel L ; devel@edk2.grou= ps.io Cc: Andrew Fish ; Ni, Ray ; Chiu, Chasel= ; Kinney, Michael D Subject: RE: [PATCH v1] EmulatorPkg: Fix Terminal Issues Thanks Nate! I have noticed this issue for a while. One comment below. With that update: Reviewed-by: Michael D Kinney Mike > -----Original Message----- > From: Desimone, Nathaniel L > Sent: Tuesday, September 26, 2023 11:36 AM > To: devel@edk2.groups.io > Cc: Andrew Fish ; Ni, Ray ; Kinney,=20 > Michael D ; Chiu, Chasel=20 > > Subject: [PATCH v1] EmulatorPkg: Fix Terminal Issues >=20 > After running EmulatorPkg, one will notice that their terminal acts=20 > strangely. This is caused by the EmulatorPkg Host changing the=20 > terminal mode and not restoring the original mode, which is now fixed. >=20 > Cc: Andrew Fish > Cc: Ray Ni > Cc: Michael D Kinney > Cc: Chasel Chiu > Signed-off-by: Nate DeSimone > --- > EmulatorPkg/Unix/Host/EmuThunk.c | 16 ++++++++++++-=20 > EmulatorPkg/Win/Host/WinThunk.c | 40 > +++++++++++++++++++++++++++++++- > 2 files changed, 54 insertions(+), 2 deletions(-) >=20 > diff --git a/EmulatorPkg/Unix/Host/EmuThunk.c > b/EmulatorPkg/Unix/Host/EmuThunk.c > index 6422f056a6..e6879db650 100644 > --- a/EmulatorPkg/Unix/Host/EmuThunk.c > +++ b/EmulatorPkg/Unix/Host/EmuThunk.c > @@ -9,7 +9,7 @@ > it may cause the table to be initialized with the members at the=20 > end being > set to zero. This is bad as jumping to zero will crash. >=20 > -Copyright (c) 2004 - 2019, Intel Corporation. All rights=20 > reserved.
> +Copyright (c) 2004 - 2023, Intel Corporation. All rights > reserved.
> Portions copyright (c) 2008 - 2011, Apple Inc. All rights=20 > reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -34,6 +34,9 @@ UINTN settimer_callback =3D 0; >=20 > BOOLEAN gEmulatorInterruptEnabled =3D FALSE; >=20 > +STATIC BOOLEAN mEmulatorStdInConfigured =3D FALSE; STATIC struct=20 > +termios mOldTty; > + > UINTN > SecWriteStdErr ( > IN UINT8 *Buffer, > @@ -58,8 +61,15 @@ SecConfigStdIn ( > // Need to turn off line buffering, ECHO, and make it unbuffered. > // > tcgetattr (STDIN_FILENO, &tty); > + if (!mEmulatorStdInConfigured) { > + // > + // Save the original state of the TTY so it can be restored on > exit > + // > + CopyMem (&mOldTty, &tty, sizeof (struct termios)); } > tty.c_lflag &=3D ~(ICANON | ECHO); > tcsetattr (STDIN_FILENO, TCSANOW, &tty); > + mEmulatorStdInConfigured =3D TRUE; >=20 > // setvbuf (STDIN_FILENO, NULL, _IONBF, 0); >=20 > @@ -338,6 +348,10 @@ SecExit ( > UINTN Status > ) > { > + // Reset the TTY back to its original state if > + (mEmulatorStdInConfigured) { > + tcsetattr (STDIN_FILENO, TCSANOW, &mOldTty); } > exit (Status); > } >=20 > diff --git a/EmulatorPkg/Win/Host/WinThunk.c=20 > b/EmulatorPkg/Win/Host/WinThunk.c index 008e5755db..90a6da2ece 100644 > --- a/EmulatorPkg/Win/Host/WinThunk.c > +++ b/EmulatorPkg/Win/Host/WinThunk.c > @@ -1,6 +1,6 @@ > /**@file >=20 > -Copyright (c) 2006 - 2018, Intel Corporation. All rights=20 > reserved.
> +Copyright (c) 2006 - 2023, Intel Corporation. All rights > reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > Module Name: > @@ -30,6 +30,12 @@ Abstract: >=20 > #include "WinHost.h" >=20 > +STATIC BOOLEAN mEmulatorStdInConfigured =3D FALSE; STATIC DWORD=20 > +mOldStdInMode; #if defined (NTDDI_VERSION) && defined > +(NTDDI_WIN10_TH2) && > (NTDDI_VERSION > NTDDI_WIN10_TH2) > + STATIC DWORD mOldStdOutMode; > +#endif > + > UINTN > SecWriteStdErr ( > IN UINT8 *Buffer, > @@ -61,6 +67,12 @@ SecConfigStdIn ( >=20 > Success =3D GetConsoleMode (GetStdHandle (STD_INPUT_HANDLE), &Mode); > if (Success) { > + if (!mEmulatorStdInConfigured) { > + // > + // Save the original state of the console so it can be restored > on exit > + // > + mOldStdInMode =3D Mode; > + } > // > // Disable buffer (line input), echo, mouse, window > // > @@ -82,6 +94,12 @@ SecConfigStdIn ( > // > if (Success) { > Success =3D GetConsoleMode (GetStdHandle (STD_OUTPUT_HANDLE),=20 > &Mode); > + if (!mEmulatorStdInConfigured) { > + // > + // Save the original state of the console so it can be restored > on exit > + // > + mOldStdOutMode =3D Mode; > + } > if (Success) { > Success =3D SetConsoleMode ( > GetStdHandle (STD_OUTPUT_HANDLE), @@ -91,6 +109,9=20 > @@ SecConfigStdIn ( > } >=20 > #endif > + if (Success) { > + mEmulatorStdInConfigured =3D TRUE; > + } > return Success ? EFI_SUCCESS : EFI_DEVICE_ERROR; } >=20 > @@ -467,6 +488,23 @@ SecExit ( > UINTN Status > ) > { > + #if defined (NTDDI_VERSION) && defined (NTDDI_WIN10_TH2) && > (NTDDI_VERSION > NTDDI_WIN10_TH2) > + BOOL Success; > + #endif > + > + if (mEmulatorStdInConfigured) { > + // > + // Reset the console back to its original state > + // > + #if defined (NTDDI_VERSION) && defined (NTDDI_WIN10_TH2) && > (NTDDI_VERSION > NTDDI_WIN10_TH2) I think the BOOL Success variable could be added here and reduce the #if st= atements > + Success =3D SetConsoleMode (GetStdHandle (STD_INPUT_HANDLE), > mOldStdInMode); > + if (Success) { > + SetConsoleMode (GetStdHandle (STD_OUTPUT_HANDLE), > mOldStdOutMode); > + } > + #else > + SetConsoleMode (GetStdHandle (STD_INPUT_HANDLE), mOldStdInMode);=20 > + #endif } > exit ((int)Status); > } >=20 > -- > 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109092): https://edk2.groups.io/g/devel/message/109092 Mute This Topic: https://groups.io/mt/101602599/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-