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