3 Copyright (c) 2006, 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.
28 extern UINT8 BdsStrings
[];
30 EFI_GUID gBdsStringPackGuid
= { 0x7bac95d3, 0xddf, 0x42f3, 0x9e, 0x24, 0x7c, 0x64, 0x49, 0x40, 0x37, 0x9a };
33 InitializeStringSupport (
40 Initialize HII global accessor for string support
51 EFI_HII_PACKAGES
*PackageList
;
53 // There should only ever be one HII protocol
55 Status
= gBS
->LocateProtocol (
60 if (!EFI_ERROR (Status
)) {
61 PackageList
= PreparePackages (1, &gBdsStringPackGuid
, BdsStrings
);
62 Status
= Hii
->NewPack (Hii
, PackageList
, &gStringPackHandle
);
63 gBS
->FreePool (PackageList
);
77 Get string by string id from HII Interface
85 CHAR16 * - String from ID.
86 NULL - If error occurs.
95 // Set default string size assumption at no more than 256 bytes
99 String
= AllocateZeroPool (StringLength
);
100 if (String
== NULL
) {
102 // If this happens, we are oh-so-dead, but return a NULL in any case.
107 // Get the current string for the current Language
109 Status
= Hii
->GetString (Hii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
110 if (EFI_ERROR (Status
)) {
111 if (Status
== EFI_BUFFER_TOO_SMALL
) {
115 gBS
->FreePool (String
);
118 // Allocate new pool with correct value
120 String
= AllocatePool (StringLength
);
121 ASSERT (String
!= NULL
);
123 Status
= Hii
->GetString (Hii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
124 if (!EFI_ERROR (Status
)) {