]>
git.proxmox.com Git - mirror_edk2.git/blob - Nt32Pkg/PlatformBdsDxe/Generic/String.c
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 "BdsString.h"
29 InitializeStringSupport (
36 Initialize HII global accessor for string support
47 EFI_HII_PACKAGES
*PackageList
;
49 // There should only ever be one HII protocol
51 Status
= gBS
->LocateProtocol (
56 if (!EFI_ERROR (Status
)) {
57 PackageList
= PreparePackages (1, &gEfiCallerIdGuid
, PlatformBdsStrings
);
58 Status
= gHii
->NewPack (gHii
, PackageList
, &gStringPackHandle
);
59 FreePool (PackageList
);
73 Get string by string id from HII Interface
81 CHAR16 * - String from ID.
82 NULL - If error occurs.
91 // Set default string size assumption at no more than 256 bytes
95 String
= AllocateZeroPool (StringLength
);
98 // If this happens, we are oh-so-dead, but return a NULL in any case.
103 // Get the current string for the current Language
105 Status
= gHii
->GetString (gHii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
106 if (EFI_ERROR (Status
)) {
107 if (Status
== EFI_BUFFER_TOO_SMALL
) {
114 // Allocate new pool with correct value
116 String
= AllocatePool (StringLength
);
117 ASSERT (String
!= NULL
);
119 Status
= gHii
->GetString (gHii
, gStringPackHandle
, Id
, FALSE
, NULL
, &StringLength
, String
);
120 if (!EFI_ERROR (Status
)) {