3 This file contains the keyboard processing code to the HII database.
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include "HiiDatabase.h"
22 IN EFI_HII_PROTOCOL
*This
,
23 IN CHAR16
*StringToTest
,
24 IN OUT UINT32
*FirstMissing
,
25 OUT UINT32
*GlyphBufferSize
30 Test if all of the characters in a string have corresponding font characters.
43 GetTagGuidByFrameworkHiiHandle (
44 IN CONST EFI_HII_THUNK_PRIVATE_DATA
*Private
,
45 IN FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle
,
49 LIST_ENTRY
*ListEntry
;
50 HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY
*HandleMapEntry
;
52 ASSERT (TagGuid
!= NULL
);
54 for (ListEntry
= Private
->HiiThunkHandleMappingDBListHead
.ForwardLink
;
55 ListEntry
!= &Private
->HiiThunkHandleMappingDBListHead
;
56 ListEntry
= ListEntry
->ForwardLink
59 HandleMapEntry
= HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry
);
61 if (FrameworkHiiHandle
== HandleMapEntry
->FrameworkHiiHandle
) {
62 CopyGuid (TagGuid
, &HandleMapEntry
->TagGuid
);
71 HiiThunkNewStringForAllStringPackages (
72 IN CONST EFI_HII_THUNK_PRIVATE_DATA
*Private
,
73 OUT CONST EFI_GUID
*TagGuid
,
75 IN OUT STRING_REF
*Reference
,
80 LIST_ENTRY
*ListEntry
;
81 HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY
*HandleMapEntry
;
82 EFI_STRING_ID StringId1
;
83 EFI_STRING_ID StringId2
;
84 CHAR8
*UefiStringProtocolLanguage
;
87 ASSERT (TagGuid
!= NULL
);
89 StringId1
= (EFI_STRING_ID
) 0;
90 StringId2
= (EFI_STRING_ID
) 0;
94 // BugBug: We will handle the case that Language is not NULL later.
96 ASSERT (Language
== NULL
);
98 //if (Language == NULL) {
99 UefiStringProtocolLanguage
= NULL
;
102 for (ListEntry
= Private
->HiiThunkHandleMappingDBListHead
.ForwardLink
;
103 ListEntry
!= &Private
->HiiThunkHandleMappingDBListHead
;
104 ListEntry
= ListEntry
->ForwardLink
107 HandleMapEntry
= HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry
);
109 if (CompareGuid (TagGuid
, &HandleMapEntry
->TagGuid
)) {
111 if (*Reference
== 0) {
112 Status
= HiiLibNewString (HandleMapEntry
->UefiHiiHandle
, &StringId2
, NewString
);
114 Status
= HiiLibSetString (HandleMapEntry
->UefiHiiHandle
, *Reference
, NewString
);
116 if (EFI_ERROR (Status
)) {
119 if (*Reference
== 0) {
120 if (StringId1
== (EFI_STRING_ID
) 0) {
121 StringId1
= StringId2
;
123 if (StringId1
!= StringId2
) {
125 return EFI_INVALID_PARAMETER
;
133 *Reference
= StringId1
;
134 Status
= EFI_SUCCESS
;
136 Status
= EFI_NOT_FOUND
;
145 IN EFI_HII_PROTOCOL
*This
,
147 IN FRAMEWORK_EFI_HII_HANDLE Handle
,
148 IN OUT STRING_REF
*Reference
,
154 This function allows a new String to be added to an already existing String Package.
155 We will make a buffer the size of the package + StrSize of the new string. We will
156 copy the string package that first gets changed and the following language packages until
157 we encounter the NULL string package. All this time we will ensure that the offsets have
167 EFI_HII_THUNK_PRIVATE_DATA
*Private
;
170 Private
= EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This
);
172 Status
= GetTagGuidByFrameworkHiiHandle (Private
, Handle
, &TagGuid
);
173 ASSERT_EFI_ERROR (Status
);
175 Status
= HiiThunkNewStringForAllStringPackages (Private
, &TagGuid
, Language
, Reference
, NewString
);
176 ASSERT_EFI_ERROR (Status
);
184 IN EFI_HII_PROTOCOL
*This
,
185 IN FRAMEWORK_EFI_HII_HANDLE Handle
191 This function removes any new strings that were added after the initial string export for this handle.
200 return EFI_UNSUPPORTED
;
206 IN EFI_HII_PROTOCOL
*This
,
207 IN FRAMEWORK_EFI_HII_HANDLE Handle
,
210 IN CHAR16
*LanguageString
,
211 IN OUT UINTN
*BufferLengthTemp
,
212 OUT EFI_STRING StringBuffer
218 This function extracts a string from a package already registered with the EFI HII database.
221 This - A pointer to the EFI_HII_PROTOCOL instance.
222 Handle - The HII handle on which the string resides.
223 Token - The string token assigned to the string.
224 Raw - If TRUE, the string is returned unedited in the internal storage format described
225 above. If false, the string returned is edited by replacing <cr> with <space>
226 and by removing special characters such as the <wide> prefix.
227 LanguageString - Pointer to a NULL-terminated string containing a single ISO 639-2 language
228 identifier, indicating the language to print. If the LanguageString is empty (starts
229 with a NULL), the default system language will be used to determine the language.
230 BufferLength - Length of the StringBuffer. If the status reports that the buffer width is too
231 small, this parameter is filled with the length of the buffer needed.
232 StringBuffer - The buffer designed to receive the characters in the string. Type EFI_STRING is
236 EFI_INVALID_PARAMETER - If input parameter is invalid.
237 EFI_BUFFER_TOO_SMALL - If the *BufferLength is too small.
238 EFI_SUCCESS - Operation is successful.
242 LIST_ENTRY
*ListEntry
;
243 HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY
*HandleMapEntry
;
244 CHAR8
*AsciiLanguage
;
245 EFI_HII_THUNK_PRIVATE_DATA
*Private
;
247 Private
= EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This
);
249 if (LanguageString
== NULL
) {
250 AsciiLanguage
= NULL
;
252 AsciiLanguage
= AllocateZeroPool (StrLen (LanguageString
) + 1);
253 if (AsciiLanguage
== NULL
) {
254 return EFI_OUT_OF_RESOURCES
;
256 UnicodeStrToAsciiStr (LanguageString
, AsciiLanguage
);
259 for (ListEntry
= Private
->HiiThunkHandleMappingDBListHead
.ForwardLink
;
260 ListEntry
!= &Private
->HiiThunkHandleMappingDBListHead
;
261 ListEntry
= ListEntry
->ForwardLink
264 HandleMapEntry
= HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry
);
266 if (Handle
== HandleMapEntry
->FrameworkHiiHandle
) {
267 if (AsciiLanguage
== NULL
) {
268 return HiiLibGetString (HandleMapEntry
->UefiHiiHandle
, Token
, StringBuffer
, BufferLengthTemp
);
270 return mUefiStringProtocol
->GetString (
273 HandleMapEntry
->UefiHiiHandle
,
283 return EFI_NOT_FOUND
;
289 IN EFI_HII_PROTOCOL
*This
,
290 IN FRAMEWORK_EFI_HII_HANDLE Handle
,
292 IN OUT UINT16
*Index
,
294 IN CHAR16
*LanguageString
,
295 IN OUT UINT16
*BufferLength
,
296 OUT EFI_STRING StringBuffer
302 This function allows a program to extract a part of a string of not more than a given width.
303 With repeated calls, this allows a calling program to extract "lines" of text that fit inside
304 columns. The effort of measuring the fit of strings inside columns is localized to this call.
313 return EFI_UNSUPPORTED
;