From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web09.2938.1632286194986297982 for ; Tue, 21 Sep 2021 21:49:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=eWe1r7Aj; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: zhichao.gao@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10114"; a="203671209" X-IronPort-AV: E=Sophos;i="5.85,312,1624345200"; d="scan'208";a="203671209" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2021 21:49:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,312,1624345200"; d="scan'208";a="550103270" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by FMSMGA003.fm.intel.com with ESMTP; 21 Sep 2021 21:49:53 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 21 Sep 2021 21:49:52 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 21 Sep 2021 21:49:52 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 21 Sep 2021 21:49:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=POSMRpUxWgjS7Yv28LiDMXx+WBbLyPczui+p8R4uHPD09yRXP5AGL0pRY7UlFMVGpg5b3XcyiDj1beI+lo4tUjifasU5L1ezN4jxSnb8gNu1A1+aworrBz5ec1eYxgwQ5P1qWVVMVihhtR/TaMMXIZtWf5CVYdQPugpFSeeJm+VTC7OFeRIXdRxe7EfmsAyI9uIh1gxnstzT6oCyGcJocD4tgRamJvQVOvFQXC8uwIIHqNHgzOb0ZYwN4wCTkNFKaw9Jtt48lI/MdeAOefZ2/jpycSRJKrZxpTouo3Nac8PN2Jp9LdpkZ4cD44gC2mIaueYMYmnnvlJKb1rm6zUbRg== 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; bh=QtU2dzBJjkki4ojU6HJrAih9THlFyN9HJF9Dd7GJBTU=; b=TZAQuFawrppBTVi9HKL1v7wwxbz6KnngEeGB2eLQI5XoTgPlUYYl9BciM4GnfnPwcu9D1m1lwjESXNRzILYBACr2twjed2z3Sj6XbXfFgnZjVSbyWcpSmoN9/zz3Js60i72N2PF3tN7L8Fb+261fvRDdLfYszzoLsfYpq7efL0daecNJg8zJY9ayig+Rr3KCreYFX8gNLoQzs7QRqQ1+bCIFceyzsqzvTl0BEesGpSCce1qV28KFPjU1inD3rFLkmBAWVUj/V9GFA+OEF7SEgWxWicaHCU59DkUnifeSdpv7Eyff51Gzo+DL86Liws3aw4wbW8nGepgc1P95bcGrpg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QtU2dzBJjkki4ojU6HJrAih9THlFyN9HJF9Dd7GJBTU=; b=eWe1r7AjXOIiZ55krtiWoau0Srzg0vAlbhLJ5Nw1tOTIWyJm4k2NckrxB5UL22R5ERc1Nn2SCcH75yhgnoIzzuWV2y0rr55PLZhHkeazTbAGKqaeUUK8q8MP8zbrBOQXjovKN3JN9JsCnNTjoHM7FZLWM7XdOfSEq02QgvqLnTM= Received: from DM4PR11MB5277.namprd11.prod.outlook.com (2603:10b6:5:388::23) by DM5PR11MB2009.namprd11.prod.outlook.com (2603:10b6:3:15::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Wed, 22 Sep 2021 04:49:51 +0000 Received: from DM4PR11MB5277.namprd11.prod.outlook.com ([fe80::fcab:50dd:7598:3b40]) by DM4PR11MB5277.namprd11.prod.outlook.com ([fe80::fcab:50dd:7598:3b40%4]) with mapi id 15.20.4544.014; Wed, 22 Sep 2021 04:49:51 +0000 From: "Gao, Zhichao" To: "Ni, Ray" , "devel@edk2.groups.io" , Liming Gao CC: "Wang, Jian J" Subject: Re: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line Thread-Topic: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line Thread-Index: AQHXpUvsuh5reQxFl0O+Aioo+AtRhauveLWAgAAW4kA= Date: Wed, 22 Sep 2021 04:49:51 +0000 Message-ID: References: <20210909072541.3069-1-zhichao.gao@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 74141a8a-2b41-4521-cf5c-08d97d8469d4 x-ms-traffictypediagnostic: DM5PR11MB2009: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:431; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0a21Sk/d1aGRs5yJSr6eFjCH9kIsJRA5+j5X0D3pcDxwKC669aSYEqVE+4yI+BVk9OPkbFVa8KWofFOTjVKcVywMU6QqpSXkwn3uqyZZE2sjcFTPKLsjmji3LKthHREmGpyq2HRuVkUDyEjZ55Czr6kMnqrHquREKxhMJaYGDaJ23IHe6tRROhL5hBJLiYXHZO4NYHgYwHfuFaPgYviHRPQwZix4sG2HyWPfcjN5ApCWzcvSQzkK0Uibu2fVKIKefueQZ0fZfYJZrC5OqRroi0zDPGLhXkTmEXuoRxMtQg3nSo12RceI/otftOeoG5Xv9ZQQ9p6GicS1IyQPgfWkxePmQWaJbG5Y0kpjGqNV0IGJnDKevOdh7GNQ1zfLLoAvcQnHxy59XFeRjt+1qxdANloUuUYfEY2sNAHVdCufT8r24aIJWpmaugsUzPTlb1A4MuqPBY7iC9O/r+sMXxJEjqO9rkRUI4yTnPjlD783fjS4xTIx8YbDO9wIbZIvaKn5TfhNGoJktmSHZfjkKIEnm7PfP2kUsFkyYnbYtyRjKXXcV+v+DHhAuzlJ6uVFngl9095PbXUpK6e5C4YCqWZRoC/8EIirWMQbv6m5ZHQnbxA2beBJe/NywFzX5VkXLALz1RA8w+ggY7miKSoRPkQNJICmC8vAvqfRhDGa2CTZV0zmDyyFKNsbXSN6b64wH3egqdfn8XIrPndSiXVjp8neRzB7hh7ii0M0bvO12dku5Vm/wv7flRRGYs79CHgP+dp645J2uOPhB7IX26Fl0oIwhW/Dpvu+B3ZEaz0DVwj1DgQ= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5277.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(38100700002)(26005)(2906002)(122000001)(186003)(966005)(55016002)(52536014)(86362001)(66556008)(66446008)(66946007)(4326008)(83380400001)(33656002)(9686003)(6506007)(5660300002)(38070700005)(8676002)(7696005)(53546011)(110136005)(8936002)(71200400001)(66476007)(316002)(508600001)(64756008)(76116006)(107886003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?boYg5YbKnRi78dr2KrWODvMqVnSIh+QG/L4iTQLD4koSTgJTduUPKFOhgQdR?= =?us-ascii?Q?kMo0tDlh5qlMinRdaPajMuNDPphyQa4nNBN2Owt2/LkWhxLn85cM2nJ9mNUc?= =?us-ascii?Q?papSEt+BOh2pcO8VTr26V2x++Bh4DlY1tY4j1g9RElJyl+HxyDtDQThSWoUG?= =?us-ascii?Q?iykzThdWH0Us/WxBvdtsfrMWIErMnT4pWy4UAdGgE2+ubuf54Ty8L7JXRmU+?= =?us-ascii?Q?x2JgObrLxibWGABu1i6aCsIfTl93/lkYOs0MUnNHn2mnMA3QdoGWD/yFB0jm?= =?us-ascii?Q?ZpJKDR5R7jS4155GwDI+OaFR4NFgrFqODPjWuhWcaWHGB5lzKPjSdL8JZpWj?= =?us-ascii?Q?S/YA06O/YhzcSfD75w4J0oT6I02kOWxhDjayXSGOa7lyQp+2Xf1e2u7V0vZ3?= =?us-ascii?Q?x01Dz46TAKNdl2t/Tjtnx/7BzUxTgygza7Lcz5fCO5fg9xBllV23Fi5WcC02?= =?us-ascii?Q?uaIKP2+zgAWX/lRbz1CXTX1M0OuycYN6L2SPr5gxW4viWeqzCEyh1Iln1SLr?= =?us-ascii?Q?Rb2bxAmecS29Soj3+Qvk7tmiBv2+RGEWWHGKED8omYlnZI5RH8mc6Fwe/LQE?= =?us-ascii?Q?Zubm3hGh/EYAieGl65jnHqWdxl6eOw+pS+C23oweOZ98vTXxS/mPB8htgXvF?= =?us-ascii?Q?zFesoVikuQAMulP0cyQDrId38zqU8iXuATFe2L4wCUp7sUvl0c7mbyGQ4Dd7?= =?us-ascii?Q?tqMPhT1ZP+q7ykBCC72fktPDqftoJfe/eUn6z5vG1rL+c/nzb8rUr8Zo1J6R?= =?us-ascii?Q?Fjb+SJY4kpQxpclTcr6T4OLPw2CFs23vgJn0pKU9VLeiYHjwTqZBgIRVFfNe?= =?us-ascii?Q?GbjrWVwrrgIHX0/pXSZDvPH+lXOlTcW7f49BDeICRlZZsqHGEyY7St8t6Pai?= =?us-ascii?Q?w+14KSVaeQErG+HWg/1FUj+5NOkAEsklDNisagE6qdgaDlaDxaHDCHGiiMXC?= =?us-ascii?Q?gU13Lp7aVfBGAV50p8vaaQZrG/WmTL7ZmaV8bYPomDB2JBvp8PekyPK+97Ee?= =?us-ascii?Q?haEmSLW6hpw7FKck+XUb9ertGb1uhSX3nz78Ttdce56Rt2cK8pPswchHLjC6?= =?us-ascii?Q?qcMrSZDiAFLcN47be2IY3Dqdp0RcXQrBagySBgHP6HVS2oLMO2XMaSOgvCay?= =?us-ascii?Q?Xnxay3gGGJWbEGsgiVWKSKjCNh79MrnLI8XveryYlEKFy9QrY0eySt1sy/tM?= =?us-ascii?Q?rVjWqgWFrXjhLiUFF0lL27/AyK3bpbEi/Hb7OJheFQkf1kAnpwbChA98wdXV?= =?us-ascii?Q?uuNLUHHpAkTjORWQd/UIZTwnmW/OYf5HuEwUwkqgYw69LYlTf3wTXYOje1E9?= =?us-ascii?Q?1gL1w9R7a2WlNkr74BbDyZRJ?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5277.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74141a8a-2b41-4521-cf5c-08d97d8469d4 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Sep 2021 04:49:51.2991 (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: CwGyLA78KoUDL2iYbh1ES950puahiM3xPNJYrHYF0/OF4a4rHssDmM2gsiPIkGKt/IBw+oWAiGOumBtClihLYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB2009 Return-Path: zhichao.gao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Liming, The solution is different with the first time we discussed on the Bugzilla.= Can you review if it is OK to you? Thanks, Zhichao > -----Original Message----- > From: Ni, Ray > Sent: Wednesday, September 22, 2021 11:28 AM > To: Gao, Zhichao ; devel@edk2.groups.io > Cc: Wang, Jian J ; Liming Gao > > Subject: RE: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit > string drawing within one line >=20 > Reviewed-by: Ray Ni >=20 > -----Original Message----- > From: Gao, Zhichao > Sent: Thursday, September 9, 2021 3:26 PM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Liming Gao > ; Ni, Ray > Subject: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string > drawing within one line >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3590 >=20 > Limit the draw box always within the screen's column and row. > Limit the string drawing within one line. >=20 > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > Cc: Jian J Wang > Cc: Liming Gao > Cc: Ray Ni > Signed-off-by: Zhichao Gao > --- >=20 > V2: >=20 > Drop the change in UefiBootManagerLib in V1. >=20 > Add the limitation in BootManagerMenuApp instead. >=20 >=20 > .../BootManagerMenuApp/BootManagerMenu.c | 72 > ++++++++++++++++++- > 1 file changed, 69 insertions(+), 3 deletions(-) >=20 > diff --git > a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu. > c > b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu. > c > index 9e729074ec..d4bdeba073 100644 > --- > a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu. > c > +++ > b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu. > c > @@ -1,7 +1,7 @@ > /** @file >=20 > The application to show the Boot Manager Menu. >=20 >=20 >=20 > -Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
>=20 > +Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 >=20 > **/ >=20 > @@ -45,9 +45,56 @@ PrintStringAt ( > IN CHAR16 *String >=20 > ) >=20 > { >=20 > + UINTN ScreenWidth; >=20 > + UINTN ScreenRows; >=20 > + CHAR16 *TurncateString; >=20 > + EFI_STATUS Status; >=20 > + UINTN ShowingLength; >=20 >=20 >=20 > gST->ConOut->SetCursorPosition (gST->ConOut, Column, Row); >=20 > - return Print (L"%s", String); >=20 > + >=20 > + gST->ConOut->QueryMode ( >=20 > + gST->ConOut, >=20 > + gST->ConOut->Mode->Mode, >=20 > + &ScreenWidth, >=20 > + &ScreenRows >=20 > + ); >=20 > + >=20 > + if (Column > (ScreenWidth - 1) || Row > (ScreenRows - 1)) { >=20 > + return 0; >=20 > + } >=20 > + >=20 > + if ((StrLen (String) + Column) > (ScreenWidth - 1)) { >=20 > + // >=20 > + // | - ScreenWidth - | >=20 > + // ...Column..................... >=20 > + // TurncateString length should leave one character for draw box and >=20 > + // require one character for string end. >=20 > + // >=20 > + ShowingLength =3D ScreenWidth - Column - 1; >=20 > + TurncateString =3D AllocatePool ((ShowingLength + 1) * sizeof (CHAR1= 6)); >=20 > + >=20 > + if (TurncateString =3D=3D NULL) { >=20 > + return 0; >=20 > + } >=20 > + >=20 > + Status =3D StrnCpyS (TurncateString, ShowingLength + 1, String, > ShowingLength - 3); >=20 > + >=20 > + if (EFI_ERROR (Status)) { >=20 > + FreePool (TurncateString); >=20 > + return 0; >=20 > + } >=20 > + >=20 > + *(TurncateString + ShowingLength - 3) =3D L'.'; >=20 > + *(TurncateString + ShowingLength - 2) =3D L'.'; >=20 > + *(TurncateString + ShowingLength - 1) =3D L'.'; >=20 > + *(TurncateString + ShowingLength) =3D L'\0'; >=20 > + ShowingLength =3D Print (L"%s", TurncateString); >=20 > + FreePool (TurncateString); >=20 > + return ShowingLength; >=20 > + } else { >=20 > + return Print (L"%s", String); >=20 > + } >=20 > } >=20 >=20 >=20 > /** >=20 > @@ -68,7 +115,22 @@ PrintCharAt ( > CHAR16 Character >=20 > ) >=20 > { >=20 > + UINTN ScreenWidth; >=20 > + UINTN ScreenRows; >=20 > + >=20 > gST->ConOut->SetCursorPosition (gST->ConOut, Column, Row); >=20 > + >=20 > + gST->ConOut->QueryMode ( >=20 > + gST->ConOut, >=20 > + gST->ConOut->Mode->Mode, >=20 > + &ScreenWidth, >=20 > + &ScreenRows >=20 > + ); >=20 > + >=20 > + if (Column > (ScreenWidth - 1) || Row > (ScreenRows - 1)) { >=20 > + return 0; >=20 > + } >=20 > + >=20 > return Print (L"%c", Character); >=20 > } >=20 >=20 >=20 > @@ -193,7 +255,11 @@ InitializeBootMenuScreen ( >=20 >=20 > MaxPrintRows =3D Row - 6; >=20 > UnSelectableItmes =3D TITLE_TOKEN_COUNT + 2 + HELP_TOKEN_COUNT + 2; >=20 > - BootMenuData->MenuScreen.Width =3D MaxStrWidth + 8; >=20 > + if (MaxStrWidth + 8 > Column) { >=20 > + BootMenuData->MenuScreen.Width =3D Column; >=20 > + } else { >=20 > + BootMenuData->MenuScreen.Width =3D MaxStrWidth + 8; >=20 > + } >=20 > if (BootMenuData->ItemCount + UnSelectableItmes > MaxPrintRows) { >=20 > BootMenuData->MenuScreen.Height =3D MaxPrintRows; >=20 > BootMenuData->ScrollBarControl.HasScrollBar =3D TRUE; >=20 > -- > 2.31.1.windows.1