258 IN EFI_STRING_ID StringId,
259 OUT UINT8 *BlockType, OPTIONAL
260 OUT UINT8 **StringBlockAddr, OPTIONAL
261 OUT UINTN *StringTextOffset, OPTIONAL
262 OUT EFI_STRING_ID *LastStringId, OPTIONAL
263 OUT EFI_STRING_ID *StartStringId OPTIONAL
267 EFI_STRING_ID CurrentStringId;
270 UINT8 *StringTextPtr;
273 EFI_FONT_INFO *FontInfo;
278 EFI_HII_FONT_STYLE FontStyle;
281 EFI_HII_SIBT_EXT2_BLOCK Ext2;
287 ASSERT (StringPackage != NULL);
293 if ((StringId != (EFI_STRING_ID)(-1)) && (StringId != 0)) {
294 ASSERT (BlockType != NULL && StringBlockAddr != NULL && StringTextOffset != NULL);
295 if (StringId > StringPackage->MaxStringId) {
296 return EFI_NOT_FOUND;
300 if ((StringId == 0) && (LastStringId != NULL)) {
301 *LastStringId = StringPackage->MaxStringId;
306 ZeroMem (&Zero,
sizeof (CHAR16));
311 BlockHdr = StringPackage->StringBlock;
314 while (*BlockHdr != EFI_HII_SIBT_END) {
316 case EFI_HII_SIBT_STRING_SCSU:
317 Offset =
sizeof (EFI_HII_STRING_BLOCK);
318 StringTextPtr = BlockHdr + Offset;
319 BlockSize += Offset + AsciiStrSize ((CHAR8 *)StringTextPtr);
323 case EFI_HII_SIBT_STRING_SCSU_FONT:
324 Offset =
sizeof (EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK) -
sizeof (UINT8);
325 StringTextPtr = BlockHdr + Offset;
326 BlockSize += Offset + AsciiStrSize ((CHAR8 *)StringTextPtr);
330 case EFI_HII_SIBT_STRINGS_SCSU:
331 CopyMem (&StringCount, BlockHdr +
sizeof (EFI_HII_STRING_BLOCK),
sizeof (UINT16));
332 StringTextPtr = (UINT8 *)((UINTN)BlockHdr +
sizeof (EFI_HII_SIBT_STRINGS_SCSU_BLOCK) -
sizeof (UINT8));
335 for (Index = 0; Index < StringCount; Index++) {
336 BlockSize += AsciiStrSize ((CHAR8 *)StringTextPtr);
337 if (CurrentStringId == StringId) {
338 ASSERT (BlockType != NULL && StringBlockAddr != NULL && StringTextOffset != NULL);
339 *BlockType = *BlockHdr;
340 *StringBlockAddr = BlockHdr;
341 *StringTextOffset = StringTextPtr - BlockHdr;
345 StringTextPtr = StringTextPtr + AsciiStrSize ((CHAR8 *)StringTextPtr);
351 case EFI_HII_SIBT_STRINGS_SCSU_FONT:
354 (UINT8 *)((UINTN)BlockHdr +
sizeof (EFI_HII_STRING_BLOCK) +
sizeof (UINT8)),
357 StringTextPtr = (UINT8 *)((UINTN)BlockHdr +
sizeof (EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK) -
sizeof (UINT8));
360 for (Index = 0; Index < StringCount; Index++) {
361 BlockSize += AsciiStrSize ((CHAR8 *)StringTextPtr);
362 if (CurrentStringId == StringId) {
363 ASSERT (BlockType != NULL && StringBlockAddr != NULL && StringTextOffset != NULL);
364 *BlockType = *BlockHdr;
365 *StringBlockAddr = BlockHdr;
366 *StringTextOffset = StringTextPtr - BlockHdr;
370 StringTextPtr = StringTextPtr + AsciiStrSize ((CHAR8 *)StringTextPtr);
376 case EFI_HII_SIBT_STRING_UCS2:
377 Offset =
sizeof (EFI_HII_STRING_BLOCK);
378 StringTextPtr = BlockHdr + Offset;
388 case EFI_HII_SIBT_STRING_UCS2_FONT:
389 Offset =
sizeof (EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK) -
sizeof (CHAR16);
390 StringTextPtr = BlockHdr + Offset;
400 case EFI_HII_SIBT_STRINGS_UCS2:
401 Offset =
sizeof (EFI_HII_SIBT_STRINGS_UCS2_BLOCK) -
sizeof (CHAR16);
402 StringTextPtr = BlockHdr + Offset;
404 CopyMem (&StringCount, BlockHdr +
sizeof (EFI_HII_STRING_BLOCK),
sizeof (UINT16));
405 for (Index = 0; Index < StringCount; Index++) {
408 if (CurrentStringId == StringId) {
409 ASSERT (BlockType != NULL && StringBlockAddr != NULL && StringTextOffset != NULL);
410 *BlockType = *BlockHdr;
411 *StringBlockAddr = BlockHdr;
412 *StringTextOffset = StringTextPtr - BlockHdr;
416 StringTextPtr = StringTextPtr + StringSize;
422 case EFI_HII_SIBT_STRINGS_UCS2_FONT:
423 Offset =
sizeof (EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK) -
sizeof (CHAR16);
424 StringTextPtr = BlockHdr + Offset;
428 (UINT8 *)((UINTN)BlockHdr +
sizeof (EFI_HII_STRING_BLOCK) +
sizeof (UINT8)),
431 for (Index = 0; Index < StringCount; Index++) {
434 if (CurrentStringId == StringId) {
435 ASSERT (BlockType != NULL && StringBlockAddr != NULL && StringTextOffset != NULL);
436 *BlockType = *BlockHdr;
437 *StringBlockAddr = BlockHdr;
438 *StringTextOffset = StringTextPtr - BlockHdr;
442 StringTextPtr = StringTextPtr + StringSize;
448 case EFI_HII_SIBT_DUPLICATE:
449 if (CurrentStringId == StringId) {
457 BlockHdr +
sizeof (EFI_HII_STRING_BLOCK),
458 sizeof (EFI_STRING_ID)
460 ASSERT (StringId != CurrentStringId);
464 BlockSize +=
sizeof (EFI_HII_SIBT_DUPLICATE_BLOCK);
470 case EFI_HII_SIBT_SKIP1:
471 SkipCount = (UINT16)(*(UINT8 *)((UINTN)BlockHdr +
sizeof (EFI_HII_STRING_BLOCK)));
472 CurrentStringId = (UINT16)(CurrentStringId + SkipCount);
473 BlockSize +=
sizeof (EFI_HII_SIBT_SKIP1_BLOCK);
476 case EFI_HII_SIBT_SKIP2:
477 CopyMem (&SkipCount, BlockHdr +
sizeof (EFI_HII_STRING_BLOCK),
sizeof (UINT16));
478 CurrentStringId = (UINT16)(CurrentStringId + SkipCount);
479 BlockSize +=
sizeof (EFI_HII_SIBT_SKIP2_BLOCK);
482 case EFI_HII_SIBT_EXT1:
485 (UINT8 *)((UINTN)BlockHdr +
sizeof (EFI_HII_STRING_BLOCK) +
sizeof (UINT8)),
491 case EFI_HII_SIBT_EXT2:
492 CopyMem (&Ext2, BlockHdr,
sizeof (EFI_HII_SIBT_EXT2_BLOCK));
493 if ((Ext2.BlockType2 == EFI_HII_SIBT_FONT) && (StringId == (EFI_STRING_ID)(-1))) {
498 BlockHdr +=
sizeof (EFI_HII_SIBT_EXT2_BLOCK);
499 CopyMem (&FontId, BlockHdr,
sizeof (UINT8));
501 CopyMem (&FontSize, BlockHdr,
sizeof (UINT16));
502 BlockHdr +=
sizeof (UINT16);
503 CopyMem (&FontStyle, BlockHdr,
sizeof (EFI_HII_FONT_STYLE));
504 BlockHdr +=
sizeof (EFI_HII_FONT_STYLE);
507 FontInfoSize =
sizeof (EFI_FONT_INFO) -
sizeof (CHAR16) + StringSize;
508 FontInfo = (EFI_FONT_INFO *)AllocateZeroPool (FontInfoSize);
509 if (FontInfo == NULL) {
510 return EFI_OUT_OF_RESOURCES;
513 FontInfo->FontStyle = FontStyle;
514 FontInfo->FontSize = FontSize;
515 CopyMem (FontInfo->FontName, BlockHdr, StringSize);
530 StringPackage->FontId++;
539 case EFI_HII_SIBT_EXT4:
542 (UINT8 *)((UINTN)BlockHdr +
sizeof (EFI_HII_STRING_BLOCK) +
sizeof (UINT8)),
553 if ((StringId > 0) && (StringId != (EFI_STRING_ID)(-1))) {
554 ASSERT (BlockType != NULL && StringBlockAddr != NULL && StringTextOffset != NULL);
555 *BlockType = *BlockHdr;
556 *StringBlockAddr = BlockHdr;
557 *StringTextOffset = Offset;
559 if (StringId == CurrentStringId - 1) {
563 if ((*BlockType == EFI_HII_SIBT_SKIP2) || (*BlockType == EFI_HII_SIBT_SKIP1)) {
564 return EFI_NOT_FOUND;
570 if (StringId < CurrentStringId - 1) {
571 return EFI_NOT_FOUND;
575 BlockHdr = StringPackage->StringBlock +
BlockSize;
576 if (StartStringId != NULL) {
577 *StartStringId = CurrentStringId;
584 if ((StringId == (EFI_STRING_ID)(-1)) && (LastStringId != NULL)) {
585 *LastStringId = (EFI_STRING_ID)(CurrentStringId - 1);
589 return EFI_NOT_FOUND;
733 IN EFI_STRING_ID StartStringId,
734 IN EFI_STRING_ID StringId,
735 IN OUT UINT8 *BlockType,
736 IN OUT UINT8 **StringBlockAddr,
746 UINT32 NewUCSBlockLen;
747 UINT8 *OldStringAddr;
752 OldStringAddr = *StringBlockAddr;
754 ASSERT (*BlockType == EFI_HII_SIBT_SKIP1 || *BlockType == EFI_HII_SIBT_SKIP2);
758 if (*BlockType == EFI_HII_SIBT_SKIP1) {
759 SkipLen =
sizeof (EFI_HII_SIBT_SKIP1_BLOCK);
760 IdCount = *(UINT8 *)(OldStringAddr +
sizeof (EFI_HII_STRING_BLOCK));
762 SkipLen =
sizeof (EFI_HII_SIBT_SKIP2_BLOCK);
763 IdCount = *(UINT16 *)(OldStringAddr +
sizeof (EFI_HII_STRING_BLOCK));
770 NewUCSBlockLen =
sizeof (EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK);
772 NewUCSBlockLen =
sizeof (EFI_HII_SIBT_STRING_UCS2_BLOCK);
775 OldBlockSize = StringPackage->StringPkgHdr->Header.Length - StringPackage->StringPkgHdr->HdrSize;
777 if (StartStringId == StringId) {
782 NewBlockSize = OldBlockSize + NewUCSBlockLen;
784 NewBlockSize = OldBlockSize + NewUCSBlockLen - SkipLen;
786 }
else if (StartStringId + IdCount - 1 == StringId) {
790 NewBlockSize = OldBlockSize + NewUCSBlockLen;
791 FrontSkipNum = StringId - StartStringId;
796 NewBlockSize = OldBlockSize + NewUCSBlockLen + SkipLen;
797 FrontSkipNum = StringId - StartStringId;
800 StringBlock = (UINT8 *)AllocateZeroPool (NewBlockSize);
801 if (StringBlock == NULL) {
802 return EFI_OUT_OF_RESOURCES;
808 CopyMem (StringBlock, StringPackage->StringBlock, OldStringAddr - StringPackage->StringBlock);
809 BlockPtr = StringBlock + (OldStringAddr - StringPackage->StringBlock);
811 if (FrontSkipNum > 0) {
812 *BlockPtr = *BlockType;
813 if (*BlockType == EFI_HII_SIBT_SKIP1) {
814 *(BlockPtr +
sizeof (EFI_HII_STRING_BLOCK)) = (UINT8)FrontSkipNum;
816 *(UINT16 *)(BlockPtr +
sizeof (EFI_HII_STRING_BLOCK)) = (UINT16)FrontSkipNum;
825 *StringBlockAddr = BlockPtr;
827 *BlockPtr = EFI_HII_SIBT_STRING_UCS2_FONT;
829 *BlockPtr = EFI_HII_SIBT_STRING_UCS2;
832 BlockPtr += NewUCSBlockLen;
834 if (IdCount > FrontSkipNum + 1) {
835 *BlockPtr = *BlockType;
836 if (*BlockType == EFI_HII_SIBT_SKIP1) {
837 *(BlockPtr +
sizeof (EFI_HII_STRING_BLOCK)) = (UINT8)(IdCount - FrontSkipNum - 1);
839 *(UINT16 *)(BlockPtr +
sizeof (EFI_HII_STRING_BLOCK)) = (UINT16)(IdCount - FrontSkipNum - 1);
848 CopyMem (BlockPtr, OldStringAddr + SkipLen, OldBlockSize - (OldStringAddr - StringPackage->StringBlock) - SkipLen);
851 *BlockType = EFI_HII_SIBT_STRING_UCS2_FONT;
853 *BlockType = EFI_HII_SIBT_STRING_UCS2;
856 FreePool (StringPackage->StringBlock);
857 StringPackage->StringBlock = StringBlock;
858 StringPackage->StringPkgHdr->Header.Length += NewBlockSize - OldBlockSize;
889 IN EFI_STRING_ID StringId,
890 IN EFI_STRING String,
891 IN EFI_FONT_INFO *StringFontInfo OPTIONAL
894 UINT8 *StringTextPtr;
896 UINT8 *StringBlockAddr;
897 UINTN StringTextOffset;
906 EFI_HII_SIBT_EXT2_BLOCK Ext2;
909 EFI_STRING_ID StartStringId;
913 ASSERT (Private != NULL && StringPackage != NULL && String != NULL);
928 if (EFI_ERROR (Status) && ((BlockType == EFI_HII_SIBT_SKIP1) || (BlockType == EFI_HII_SIBT_SKIP2))) {
935 (BOOLEAN)(StringFontInfo != NULL)
937 if (EFI_ERROR (Status)) {
941 if (StringFontInfo != NULL) {
942 StringTextOffset =
sizeof (EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK) -
sizeof (CHAR16);
944 StringTextOffset =
sizeof (EFI_HII_SIBT_STRING_UCS2_BLOCK) -
sizeof (CHAR16);
955 if (StringFontInfo != NULL) {
957 return EFI_INVALID_PARAMETER;
962 StringPackage->FontId,
968 StringPackage->FontId++;
976 case EFI_HII_SIBT_STRING_SCSU_FONT:
977 case EFI_HII_SIBT_STRINGS_SCSU_FONT:
978 case EFI_HII_SIBT_STRING_UCS2_FONT:
979 case EFI_HII_SIBT_STRINGS_UCS2_FONT:
980 *(StringBlockAddr +
sizeof (EFI_HII_STRING_BLOCK)) = LocalFont->
FontId;
988 return EFI_UNSUPPORTED;
992 OldBlockSize = StringPackage->StringPkgHdr->Header.Length - StringPackage->StringPkgHdr->HdrSize;
997 StringTextPtr = StringBlockAddr + StringTextOffset;
999 case EFI_HII_SIBT_STRING_SCSU:
1000 case EFI_HII_SIBT_STRING_SCSU_FONT:
1001 case EFI_HII_SIBT_STRINGS_SCSU:
1002 case EFI_HII_SIBT_STRINGS_SCSU_FONT:
1003 BlockSize = OldBlockSize + StrLen (String);
1004 BlockSize -= AsciiStrSize ((CHAR8 *)StringTextPtr);
1006 if (Block == NULL) {
1007 return EFI_OUT_OF_RESOURCES;
1010 CopyMem (Block, StringPackage->StringBlock, StringTextPtr - StringPackage->StringBlock);
1011 BlockPtr = Block + (StringTextPtr - StringPackage->StringBlock);
1013 while (*String != 0) {
1014 *BlockPtr++ = (CHAR8)*String++;
1019 TmpSize = OldBlockSize - (StringTextPtr - StringPackage->StringBlock) - AsciiStrSize ((CHAR8 *)StringTextPtr);
1022 StringTextPtr + AsciiStrSize ((CHAR8 *)StringTextPtr),
1026 ZeroMem (StringPackage->StringBlock, OldBlockSize);
1027 FreePool (StringPackage->StringBlock);
1028 StringPackage->StringBlock = Block;
1029 StringPackage->StringPkgHdr->Header.Length += (UINT32)(
BlockSize - OldBlockSize);
1032 case EFI_HII_SIBT_STRING_UCS2:
1033 case EFI_HII_SIBT_STRING_UCS2_FONT:
1034 case EFI_HII_SIBT_STRINGS_UCS2:
1035 case EFI_HII_SIBT_STRINGS_UCS2_FONT:
1042 BlockSize = OldBlockSize + StrSize (String) - StringSize;
1044 if (Block == NULL) {
1045 return EFI_OUT_OF_RESOURCES;
1048 CopyMem (Block, StringPackage->StringBlock, StringTextPtr - StringPackage->StringBlock);
1049 BlockPtr = Block + (StringTextPtr - StringPackage->StringBlock);
1051 CopyMem (BlockPtr, String, StrSize (String));
1052 BlockPtr += StrSize (String);
1056 StringTextPtr + StringSize,
1057 OldBlockSize - (StringTextPtr - StringPackage->StringBlock) - StringSize
1060 ZeroMem (StringPackage->StringBlock, OldBlockSize);
1061 FreePool (StringPackage->StringBlock);
1062 StringPackage->StringBlock = Block;
1063 StringPackage->StringPkgHdr->Header.Length += (UINT32)(
BlockSize - OldBlockSize);
1067 return EFI_NOT_FOUND;
1077 if ((StringFontInfo == NULL) || Referred) {
1081 OldBlockSize = StringPackage->StringPkgHdr->Header.Length - StringPackage->StringPkgHdr->HdrSize;
1082 BlockSize = OldBlockSize +
sizeof (EFI_HII_SIBT_FONT_BLOCK) -
sizeof (CHAR16) +
1083 StrSize (GlobalFont->
FontInfo->FontName);
1086 if (Block == NULL) {
1087 return EFI_OUT_OF_RESOURCES;
1091 Ext2.Header.BlockType = EFI_HII_SIBT_EXT2;
1092 Ext2.BlockType2 = EFI_HII_SIBT_FONT;
1093 Ext2.Length = (UINT16)(
BlockSize - OldBlockSize);
1094 CopyMem (BlockPtr, &Ext2,
sizeof (EFI_HII_SIBT_EXT2_BLOCK));
1095 BlockPtr +=
sizeof (EFI_HII_SIBT_EXT2_BLOCK);
1097 *BlockPtr = LocalFont->
FontId;
1100 BlockPtr +=
sizeof (UINT16);
1101 CopyMem (BlockPtr, &GlobalFont->
FontInfo->FontStyle, sizeof (UINT32));
1102 BlockPtr +=
sizeof (UINT32);
1106 StrSize (GlobalFont->
FontInfo->FontName)
1108 BlockPtr += StrSize (GlobalFont->
FontInfo->FontName);
1110 CopyMem (BlockPtr, StringPackage->StringBlock, OldBlockSize);
1112 ZeroMem (StringPackage->StringBlock, OldBlockSize);
1113 FreePool (StringPackage->StringBlock);
1114 StringPackage->StringBlock = Block;
1115 StringPackage->StringPkgHdr->Header.Length += Ext2.Length;
1157 IN CONST EFI_HII_STRING_PROTOCOL *This,
1158 IN EFI_HII_HANDLE PackageList,
1159 OUT EFI_STRING_ID *StringId,
1160 IN CONST CHAR8 *Language,
1161 IN CONST CHAR16 *LanguageName, OPTIONAL
1162 IN CONST EFI_STRING String,
1163 IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL
1174 UINT32 OldBlockSize;
1177 UINT32 Ucs2BlockSize;
1178 UINT32 FontBlockSize;
1179 UINT32 Ucs2FontBlockSize;
1180 EFI_HII_SIBT_EXT2_BLOCK Ext2;
1183 EFI_STRING_ID NewStringId;
1184 EFI_STRING_ID NextStringId;
1185 EFI_STRING_ID Index;
1187 BOOLEAN NewStringPackageCreated;
1189 if ((This == NULL) || (String == NULL) || (StringId == NULL) || (Language == NULL) || (PackageList == NULL)) {
1190 return EFI_INVALID_PARAMETER;
1194 return EFI_NOT_FOUND;
1203 if (StringFontInfo != NULL) {
1204 if (!
IsFontInfoExisted (Private, (EFI_FONT_INFO *)StringFontInfo, NULL, NULL, &GlobalFont)) {
1205 return EFI_INVALID_PARAMETER;
1212 PackageListNode = NULL;
1215 if (DatabaseRecord->
Handle == PackageList) {
1221 if (PackageListNode == NULL) {
1222 return EFI_NOT_FOUND;
1227 Status = EFI_SUCCESS;
1228 NewStringPackageCreated = FALSE;
1231 StringPackage = NULL;
1232 MatchStringPackage = NULL;
1235 Link = Link->ForwardLink
1253 if (EFI_ERROR (Status)) {
1260 if ((NewStringId != 0) && (NewStringId != NextStringId)) {
1262 Status = EFI_INVALID_PARAMETER;
1266 NewStringId = NextStringId;
1271 MatchStringPackage = StringPackage;
1277 Ucs2BlockSize = (UINT32)
sizeof (EFI_HII_SIBT_STRING_UCS2_BLOCK);
1279 StringBlock = (UINT8 *)AllocateZeroPool (OldBlockSize + Ucs2BlockSize);
1280 if (StringBlock == NULL) {
1281 Status = EFI_OUT_OF_RESOURCES;
1288 CopyMem (StringBlock, StringPackage->
StringBlock, OldBlockSize - sizeof (EFI_HII_SIBT_END_BLOCK));
1292 BlockPtr = StringBlock + OldBlockSize -
sizeof (EFI_HII_SIBT_END_BLOCK);
1293 *BlockPtr = EFI_HII_SIBT_STRING_UCS2;
1294 BlockPtr +=
sizeof (EFI_HII_SIBT_STRING_UCS2_BLOCK);
1299 *BlockPtr = EFI_HII_SIBT_END;
1303 StringPackage->
StringPkgHdr->Header.Length += Ucs2BlockSize;
1308 if (NewStringId == 0) {
1318 *StringId = (EFI_STRING_ID)(NewStringId + 1);
1321 if (MatchStringPackage != NULL) {
1322 StringPackage = MatchStringPackage;
1327 if (LanguageName == NULL) {
1328 Status = EFI_INVALID_PARAMETER;
1333 if (StringPackage == NULL) {
1334 Status = EFI_OUT_OF_RESOURCES;
1340 StringPackage->
FontId = 0;
1346 HeaderSize = (UINT32)(AsciiStrSize ((CHAR8 *)Language) - 1 +
sizeof (EFI_HII_STRING_PACKAGE_HDR));
1347 StringPackage->
StringPkgHdr = AllocateZeroPool (HeaderSize);
1349 FreePool (StringPackage);
1350 Status = EFI_OUT_OF_RESOURCES;
1354 StringPackage->
StringPkgHdr->Header.Type = EFI_HII_PACKAGE_STRINGS;
1356 StringPackage->
StringPkgHdr->StringInfoOffset = HeaderSize;
1359 AsciiStrCpyS (StringPackage->
StringPkgHdr->Language, (HeaderSize - OFFSET_OF (EFI_HII_STRING_PACKAGE_HDR, Language)) /
sizeof (CHAR8), (CHAR8 *)Language);
1365 Ucs2BlockSize = (UINT32)(StrSize ((CHAR16 *)LanguageName) +
1366 (*StringId - 1) *
sizeof (EFI_HII_SIBT_STRING_UCS2_BLOCK) -
sizeof (CHAR16));
1368 BlockSize = Ucs2BlockSize +
sizeof (EFI_HII_SIBT_END_BLOCK);
1372 FreePool (StringPackage);
1373 Status = EFI_OUT_OF_RESOURCES;
1381 *BlockPtr = EFI_HII_SIBT_STRING_UCS2;
1382 BlockPtr +=
sizeof (EFI_HII_STRING_BLOCK);
1383 CopyMem (BlockPtr, (EFI_STRING)LanguageName, StrSize ((EFI_STRING)LanguageName));
1384 BlockPtr += StrSize ((EFI_STRING)LanguageName);
1385 for (Index = 2; Index <= *StringId - 1; Index++) {
1386 *BlockPtr = EFI_HII_SIBT_STRING_UCS2;
1387 BlockPtr +=
sizeof (EFI_HII_SIBT_STRING_UCS2_BLOCK);
1393 *BlockPtr = EFI_HII_SIBT_END;
1401 NewStringPackageCreated = TRUE;
1406 if (StringFontInfo == NULL) {
1410 Ucs2BlockSize = (UINT32)(StrSize (String) +
sizeof (EFI_HII_SIBT_STRING_UCS2_BLOCK)
1413 StringBlock = (UINT8 *)AllocateZeroPool (OldBlockSize + Ucs2BlockSize);
1414 if (StringBlock == NULL) {
1415 Status = EFI_OUT_OF_RESOURCES;
1422 CopyMem (StringBlock, StringPackage->
StringBlock, OldBlockSize - sizeof (EFI_HII_SIBT_END_BLOCK));
1426 BlockPtr = StringBlock + OldBlockSize -
sizeof (EFI_HII_SIBT_END_BLOCK);
1427 *BlockPtr = EFI_HII_SIBT_STRING_UCS2;
1428 BlockPtr +=
sizeof (EFI_HII_STRING_BLOCK);
1429 CopyMem (BlockPtr, (EFI_STRING)String, StrSize ((EFI_STRING)String));
1430 BlockPtr += StrSize ((EFI_STRING)String);
1435 *BlockPtr = EFI_HII_SIBT_END;
1439 StringPackage->
StringPkgHdr->Header.Length += Ucs2BlockSize;
1448 Ucs2FontBlockSize = (UINT32)(StrSize (String) +
sizeof (EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK) -
1454 StringBlock = (UINT8 *)AllocateZeroPool (OldBlockSize + Ucs2FontBlockSize);
1455 if (StringBlock == NULL) {
1456 Status = EFI_OUT_OF_RESOURCES;
1463 CopyMem (StringBlock, StringPackage->
StringBlock, OldBlockSize - sizeof (EFI_HII_SIBT_END_BLOCK));
1467 BlockPtr = StringBlock + OldBlockSize -
sizeof (EFI_HII_SIBT_END_BLOCK);
1468 *BlockPtr = EFI_HII_SIBT_STRING_UCS2_FONT;
1469 BlockPtr +=
sizeof (EFI_HII_STRING_BLOCK);
1470 *BlockPtr = LocalFont->
FontId;
1472 CopyMem (BlockPtr, (EFI_STRING)String, StrSize ((EFI_STRING)String));
1473 BlockPtr += StrSize ((EFI_STRING)String);
1478 *BlockPtr = EFI_HII_SIBT_END;
1482 StringPackage->
StringPkgHdr->Header.Length += Ucs2FontBlockSize;
1483 PackageListNode->
PackageListHdr.PackageLength += Ucs2FontBlockSize;
1490 FontBlockSize = (UINT32)(StrSize (((EFI_FONT_INFO *)StringFontInfo)->FontName) +
1491 sizeof (EFI_HII_SIBT_FONT_BLOCK) -
sizeof (CHAR16));
1492 StringBlock = (UINT8 *)AllocateZeroPool (OldBlockSize + FontBlockSize + Ucs2FontBlockSize);
1493 if (StringBlock == NULL) {
1494 Status = EFI_OUT_OF_RESOURCES;
1501 CopyMem (StringBlock, StringPackage->
StringBlock, OldBlockSize - sizeof (EFI_HII_SIBT_END_BLOCK));
1507 BlockPtr = StringBlock + OldBlockSize -
sizeof (EFI_HII_SIBT_END_BLOCK);
1509 Ext2.Header.BlockType = EFI_HII_SIBT_EXT2;
1510 Ext2.BlockType2 = EFI_HII_SIBT_FONT;
1511 Ext2.Length = (UINT16)FontBlockSize;
1512 CopyMem (BlockPtr, &Ext2,
sizeof (EFI_HII_SIBT_EXT2_BLOCK));
1513 BlockPtr +=
sizeof (EFI_HII_SIBT_EXT2_BLOCK);
1515 *BlockPtr = LocalFont->
FontId;
1517 CopyMem (BlockPtr, &((EFI_FONT_INFO *)StringFontInfo)->FontSize,
sizeof (UINT16));
1518 BlockPtr +=
sizeof (UINT16);
1519 CopyMem (BlockPtr, &((EFI_FONT_INFO *)StringFontInfo)->FontStyle,
sizeof (EFI_HII_FONT_STYLE));
1520 BlockPtr +=
sizeof (EFI_HII_FONT_STYLE);
1523 &((EFI_FONT_INFO *)StringFontInfo)->FontName,
1524 StrSize (((EFI_FONT_INFO *)StringFontInfo)->FontName)
1526 BlockPtr += StrSize (((EFI_FONT_INFO *)StringFontInfo)->FontName);
1530 *BlockPtr = EFI_HII_SIBT_STRING_UCS2_FONT;
1531 BlockPtr +=
sizeof (EFI_HII_STRING_BLOCK);
1532 *BlockPtr = LocalFont->
FontId;
1534 CopyMem (BlockPtr, (EFI_STRING)String, StrSize ((EFI_STRING)String));
1535 BlockPtr += StrSize ((EFI_STRING)String);
1540 *BlockPtr = EFI_HII_SIBT_END;
1544 StringPackage->
StringPkgHdr->Header.Length += FontBlockSize + Ucs2FontBlockSize;
1545 PackageListNode->
PackageListHdr.PackageLength += FontBlockSize + Ucs2FontBlockSize;
1556 if (!EFI_ERROR (Status) && NewStringPackageCreated) {
1562 EFI_HII_DATABASE_NOTIFY_NEW_PACK,
1563 (VOID *)StringPackage,
1564 EFI_HII_PACKAGE_STRINGS,
1569 if (!EFI_ERROR (Status)) {
1575 Link = Link->ForwardLink
1581 }
else if (NewStringPackageCreated) {
1588 FreePool (StringPackage);
1599 if (!EFI_ERROR (Status)) {