+/*++\r
+\r
+Copyright (c) 2004 - 2008, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+Module Name:\r
+\r
+ String.c\r
+\r
+Abstract:\r
+\r
+ String support\r
+\r
+--*/\r
+\r
+#include "Bds.h"\r
+#include "Language.h"\r
+#include "FrontPage.h"\r
+\r
+EFI_HII_HANDLE gStringPackHandle;\r
+\r
+EFI_GUID mBdsStringPackGuid = {\r
+ 0x7bac95d3, 0xddf, 0x42f3, 0x9e, 0x24, 0x7c, 0x64, 0x49, 0x40, 0x37, 0x9a\r
+};\r
+\r
+EFI_STATUS\r
+InitializeStringSupport (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Initialize HII global accessor for string support\r
+\r
+Arguments:\r
+ None\r
+\r
+Returns:\r
+ EFI_SUCCESS - String support initialize success.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_HANDLE DriverHandle;\r
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;\r
+\r
+ Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gHiiDatabase);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ //\r
+ // Create driver handle used by HII database\r
+ //\r
+ Status = HiiLibCreateHiiDriverHandle (&DriverHandle);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ PackageList = PreparePackageList (1, &mBdsStringPackGuid, &BdsStrings);\r
+ ASSERT (PackageList != NULL);\r
+\r
+ Status = gHiiDatabase->NewPackageList (\r
+ gHiiDatabase,\r
+ PackageList,\r
+ DriverHandle,\r
+ &gStringPackHandle\r
+ );\r
+\r
+ FreePool (PackageList);\r
+ return Status;\r
+}\r
+\r
+CHAR16 *\r
+GetStringById (\r
+ IN EFI_STRING_ID Id\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Get string by string id from HII Interface\r
+\r
+Arguments:\r
+ Id - String ID.\r
+\r
+Returns:\r
+ CHAR16 * - String from ID.\r
+ NULL - If error occurs.\r
+\r
+--*/\r
+{\r
+ CHAR16 *String;\r
+\r
+ String = NULL;\r
+ GetStringFromHandle (gStringPackHandle, Id, &String);\r
+\r
+ return String;\r
+}\r