]>
Commit | Line | Data |
---|---|---|
fd6a62f3 | 1 | /** @file\r |
2 | String support\r | |
93e3992d | 3 | \r |
fd6a62f3 | 4 | Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r |
93e3992d | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
fd6a62f3 | 13 | **/\r |
93e3992d | 14 | \r |
15 | #include "Bds.h"\r | |
16 | #include "Language.h"\r | |
17 | #include "FrontPage.h"\r | |
18 | \r | |
19 | EFI_HII_HANDLE gStringPackHandle;\r | |
20 | \r | |
21 | EFI_GUID mBdsStringPackGuid = {\r | |
555e76f8 | 22 | 0x7bac95d3, 0xddf, 0x42f3, {0x9e, 0x24, 0x7c, 0x64, 0x49, 0x40, 0x37, 0x9a}\r |
93e3992d | 23 | };\r |
24 | \r | |
b30312ba | 25 | /**\r |
93e3992d | 26 | Initialize HII global accessor for string support\r |
27 | \r | |
b30312ba | 28 | @retval EFI_SUCCESS String support initialize success.\r |
93e3992d | 29 | \r |
b30312ba | 30 | **/\r |
31 | EFI_STATUS\r | |
32 | InitializeStringSupport (\r | |
33 | VOID\r | |
34 | )\r | |
93e3992d | 35 | {\r |
36 | EFI_STATUS Status;\r | |
37 | EFI_HANDLE DriverHandle;\r | |
38 | EFI_HII_PACKAGE_LIST_HEADER *PackageList;\r | |
39 | \r | |
40 | Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gHiiDatabase);\r | |
41 | if (EFI_ERROR (Status)) {\r | |
42 | return Status;\r | |
43 | }\r | |
44 | \r | |
45 | //\r | |
46 | // Create driver handle used by HII database\r | |
47 | //\r | |
48 | Status = HiiLibCreateHiiDriverHandle (&DriverHandle);\r | |
49 | if (EFI_ERROR (Status)) {\r | |
50 | return Status;\r | |
51 | }\r | |
52 | \r | |
062539cf | 53 | PackageList = HiiLibPreparePackageList (1, &mBdsStringPackGuid, &BdsDxeStrings);\r |
93e3992d | 54 | ASSERT (PackageList != NULL);\r |
55 | \r | |
56 | Status = gHiiDatabase->NewPackageList (\r | |
57 | gHiiDatabase,\r | |
58 | PackageList,\r | |
59 | DriverHandle,\r | |
60 | &gStringPackHandle\r | |
61 | );\r | |
62 | \r | |
63 | FreePool (PackageList);\r | |
64 | return Status;\r | |
65 | }\r | |
66 | \r | |
b30312ba | 67 | /**\r |
93e3992d | 68 | Get string by string id from HII Interface\r |
69 | \r | |
93e3992d | 70 | \r |
b30312ba | 71 | @param Id String ID.\r |
72 | \r | |
73 | @retval CHAR16 * String from ID.\r | |
74 | @retval NULL If error occurs.\r | |
93e3992d | 75 | \r |
b30312ba | 76 | **/\r |
77 | CHAR16 *\r | |
78 | GetStringById (\r | |
79 | IN EFI_STRING_ID Id\r | |
80 | )\r | |
93e3992d | 81 | {\r |
82 | CHAR16 *String;\r | |
83 | \r | |
84 | String = NULL;\r | |
9226efe5 | 85 | HiiLibGetStringFromHandle (gStringPackHandle, Id, &String);\r |
93e3992d | 86 | \r |
87 | return String;\r | |
88 | }\r |