3 Copyright (c) 2006 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 // Include common header file for this module.
27 #include "CommonHeader.h"
33 extern UINT8 BdsStrings
[];
35 EFI_GUID gBdsStringPackGuid
= { 0x7bac95d3, 0xddf, 0x42f3, 0x9e, 0x24, 0x7c, 0x64, 0x49, 0x40, 0x37, 0x9a };
38 InitializeStringSupport (
45 Initialize HII global accessor for string support
56 EFI_HII_PACKAGES
*PackageList
;
58 // There should only ever be one HII protocol
60 Status
= gBS
->LocateProtocol (
65 if (!EFI_ERROR (Status
)) {
66 PackageList
= PreparePackages (1, &gBdsStringPackGuid
, BdsStrings
);
67 Status
= Hii
->NewPack (Hii
, PackageList
, &gStringPackHandle
);
68 FreePool (PackageList
);
82 Get string by string id from HII Interface
90 CHAR16 * - String from ID.
91 NULL - If error occurs.
100 // Set default string size assumption at no more than 256 bytes
102 StringLength
= 0x100;
104 String
= AllocateZeroPool (StringLength
);
105 if (String
== NULL
) {
107 // If this happens, we are oh-so-dead, but return a NULL in any case.
112 // Get the current string for the current Language
114 Status
= Hii
->GetString (Hii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
115 if (EFI_ERROR (Status
)) {
116 if (Status
== EFI_BUFFER_TOO_SMALL
) {
123 // Allocate new pool with correct value
125 String
= AllocatePool (StringLength
);
126 ASSERT (String
!= NULL
);
128 Status
= Hii
->GetString (Hii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
129 if (!EFI_ERROR (Status
)) {