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"
30 #include "BdsString.h"
33 EFI_GUID gBdsStringPackGuid
= { 0x7bac95d3, 0xddf, 0x42f3, 0x9e, 0x24, 0x7c, 0x64, 0x49, 0x40, 0x37, 0x9a };
34 extern UINT8 PlatformBdsStrings
[];
37 InitializeStringSupport (
44 Initialize HII global accessor for string support
55 EFI_HII_PACKAGES
*PackageList
;
57 // There should only ever be one HII protocol
59 Status
= gBS
->LocateProtocol (
64 if (!EFI_ERROR (Status
)) {
65 PackageList
= PreparePackages (1, &gBdsStringPackGuid
, PlatformBdsStrings
);
66 Status
= Hii
->NewPack (Hii
, PackageList
, &gStringPackHandle
);
67 FreePool (PackageList
);
81 Get string by string id from HII Interface
89 CHAR16 * - String from ID.
90 NULL - If error occurs.
99 // Set default string size assumption at no more than 256 bytes
101 StringLength
= 0x100;
103 String
= AllocateZeroPool (StringLength
);
104 if (String
== NULL
) {
106 // If this happens, we are oh-so-dead, but return a NULL in any case.
111 // Get the current string for the current Language
113 Status
= Hii
->GetString (Hii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
114 if (EFI_ERROR (Status
)) {
115 if (Status
== EFI_BUFFER_TOO_SMALL
) {
122 // Allocate new pool with correct value
124 String
= AllocatePool (StringLength
);
125 ASSERT (String
!= NULL
);
127 Status
= Hii
->GetString (Hii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
128 if (!EFI_ERROR (Status
)) {