]>
git.proxmox.com Git - mirror_edk2.git/blob - Nt32Pkg/PlatformBdsDxe/Generic/String.c
cbb35d027be0333bd05fed29494db476745cc8bf
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"
34 InitializeStringSupport (
41 Initialize HII global accessor for string support
52 EFI_HII_PACKAGES
*PackageList
;
54 // There should only ever be one HII protocol
56 Status
= gBS
->LocateProtocol (
61 if (!EFI_ERROR (Status
)) {
62 PackageList
= PreparePackages (1, &gEfiCallerIdGuid
, PlatformBdsStrings
);
63 Status
= gHii
->NewPack (gHii
, PackageList
, &gStringPackHandle
);
64 FreePool (PackageList
);
78 Get string by string id from HII Interface
86 CHAR16 * - String from ID.
87 NULL - If error occurs.
96 // Set default string size assumption at no more than 256 bytes
100 String
= AllocateZeroPool (StringLength
);
101 if (String
== NULL
) {
103 // If this happens, we are oh-so-dead, but return a NULL in any case.
108 // Get the current string for the current Language
110 Status
= gHii
->GetString (gHii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
111 if (EFI_ERROR (Status
)) {
112 if (Status
== EFI_BUFFER_TOO_SMALL
) {
119 // Allocate new pool with correct value
121 String
= AllocatePool (StringLength
);
122 ASSERT (String
!= NULL
);
124 Status
= gHii
->GetString (gHii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
125 if (!EFI_ERROR (Status
)) {