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