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