2 #include <Library/DebugLib.h>
3 #include <Library/HiiLib.h>
4 #include <Library/MemoryAllocationLib.h>
5 #include <Library/UefiBootServicesTableLib.h>
8 CHAR16
*gEmptyString
= L
" ";
11 Get the string based on the StringId and HII Package List Handle.
13 @param Token The String's ID.
14 @param HiiHandle The package list in the HII database to search for
17 @return The output string.
22 IN EFI_STRING_ID Token
,
23 IN EFI_HII_HANDLE HiiHandle
31 // Set default string size assumption at no more than 256 bytes
34 String
= AllocateZeroPool (BufferLength
);
35 ASSERT (String
!= NULL
);
37 Status
= HiiLibGetString (HiiHandle
, Token
, String
, &BufferLength
);
39 if (Status
== EFI_BUFFER_TOO_SMALL
) {
40 gBS
->FreePool (String
);
41 String
= AllocateZeroPool (BufferLength
);
42 ASSERT (String
!= NULL
);
44 Status
= HiiLibGetString (HiiHandle
, Token
, String
, &BufferLength
);
46 ASSERT_EFI_ERROR (Status
);
52 Create a new string in HII Package List.
54 @param String The String to be added
55 @param HiiHandle The package list in the HII database to insert the
58 @return The output string.
64 IN EFI_HII_HANDLE HiiHandle
67 EFI_STRING_ID StringId
;
71 Status
= HiiLibNewString (HiiHandle
, &StringId
, String
);
72 ASSERT_EFI_ERROR (Status
);