Step to UEFI (266)Setup 界面添加字符的实验

最近有一个有趣的想法:如何在 Setup 界面上添加字符,比如:增加 www.lab-z.com这个字样。

经过在 EDK2 代码中搜索,在MdeModulePkg\Library\CustomizedDisplayLib\CustomizedDisplayLibInternal.c 文件中找到如下函数:

/**
  Print framework and form title for a page.

  @param[in]  FormData             Form Data to be shown in Page
**/
VOID
PrintFramework (
  IN FORM_DISPLAY_ENGINE_FORM  *FormData
  )

Setup界面是在这里进行绘制的,最简单的修改就是在绘制完成之后写上需要的字符。

/**
  Print framework and form title for a page.

  @param[in]  FormData             Form Data to be shown in Page
**/
VOID
PrintFramework (
  IN FORM_DISPLAY_ENGINE_FORM  *FormData
  )
{
  UINTN   Index;
  CHAR16  Character;
  CHAR16  *Buffer;
  UINTN   Row;
  CHAR16  *TitleStr;
  UINTN   TitleColumn;
  CHAR16  StrBuffer[]=L"WWW.LAB-Z.COM";

  if (gClassOfVfr != FORMSET_CLASS_PLATFORM_SETUP) {
    //
    // Only Setup page needs Framework
    //
    ClearLines (
      gScreenDimensions.LeftColumn,
      gScreenDimensions.RightColumn,
      gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight,
      gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - 1,
      KEYHELP_TEXT | KEYHELP_BACKGROUND
      );
    return;
  }
…………………………………………….
…………………………………………….
…………………………………………….
  Character = BOXDRAW_UP_RIGHT;
  PrintCharAt (gScreenDimensions.LeftColumn, gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - 1, Character);

  PrintStringAt ((UINTN)-1, (UINTN)-1, Buffer);

  Character = BOXDRAW_UP_LEFT;
  PrintCharAt ((UINTN)-1, (UINTN)-1, Character);

  FreePool (Buffer);
  
  //LABZ_Debug_Start
  PrintStringAt (1, 0, StrBuffer);
  //LABZ_Debug_End
}

运行结果:

左上角出现我们设定的字符

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

CAPTCHAis initialing...