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 EdkGenericPlatformBdsLibStrings
[];
30 EFI_GUID gBdsStringPackGuid
= { 0x7bac95d3, 0xddf, 0x42f3, {0x9e, 0x24, 0x7c, 0x64, 0x49, 0x40, 0x37, 0x9a} };
32 EFI_HII_HANDLE gStringPackHandle
;
33 EFI_HII_PROTOCOL
*Hii
;
36 InitializeStringSupport (
43 Initialize HII global accessor for string support
54 EFI_HII_PACKAGES
*PackageList
;
56 // There should only ever be one HII protocol
58 Status
= gBS
->LocateProtocol (
63 if (!EFI_ERROR (Status
)) {
64 PackageList
= PreparePackages (1, &gBdsStringPackGuid
, EdkGenericPlatformBdsLibStrings
);
65 Status
= Hii
->NewPack (Hii
, PackageList
, &gStringPackHandle
);
66 gBS
->FreePool (PackageList
);
80 Get string by string id from HII Interface
88 CHAR16 * - String from ID.
89 NULL - If error occurs.
98 // Set default string size assumption at no more than 256 bytes
100 StringLength
= 0x100;
102 String
= AllocateZeroPool (StringLength
);
103 if (String
== NULL
) {
105 // If this happens, we are oh-so-dead, but return a NULL in any case.
110 // Get the current string for the current Language
112 Status
= Hii
->GetString (Hii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
113 if (EFI_ERROR (Status
)) {
114 if (Status
== EFI_BUFFER_TOO_SMALL
) {
118 gBS
->FreePool (String
);
121 // Allocate new pool with correct value
123 String
= AllocatePool (StringLength
);
124 ASSERT (String
!= NULL
);
126 Status
= Hii
->GetString (Hii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
127 if (!EFI_ERROR (Status
)) {