2 This library retrieves pointers to the UEFI HII Protocol instances in the
3 library's constructor. All of the UEFI HII related protocols are optional,
4 so the consumers of this library class must verify that the global variable
5 pointers are not NULL before use.
7 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include <Library/UefiHiiServicesLib.h>
21 #include <Library/UefiBootServicesTableLib.h>
22 #include <Library/DebugLib.h>
24 #include <Protocol/HiiFont.h>
25 #include <Protocol/HiiString.h>
26 #include <Protocol/HiiImage.h>
27 #include <Protocol/HiiDatabase.h>
28 #include <Protocol/HiiConfigRouting.h>
31 /// Pointer to the UEFI HII Font Protocol
33 EFI_HII_FONT_PROTOCOL
*gHiiFont
= NULL
;
36 /// Pointer to the UEFI HII String Protocol
38 EFI_HII_STRING_PROTOCOL
*gHiiString
= NULL
;
41 /// Pointer to the UEFI HII Image Protocol
43 EFI_HII_IMAGE_PROTOCOL
*gHiiImage
= NULL
;
46 /// Pointer to the UEFI HII Database Protocol
48 EFI_HII_DATABASE_PROTOCOL
*gHiiDatabase
= NULL
;
51 /// Pointer to the UEFI HII Config Rounting Protocol
53 EFI_HII_CONFIG_ROUTING_PROTOCOL
*gHiiConfigRouting
= NULL
;
56 The constructor function retrieves pointers to the UEFI HII protocol instances
58 The constructor function retrieves pointers to the four UEFI HII protocols from the
59 handle database. These include the UEFI HII Font Protocol, the UEFI HII String
60 Protocol, the UEFI HII Image Protocol, the UEFI HII Database Protocol, and the
61 UEFI HII Config Routing Protocol. This function always return EFI_SUCCESS.
62 All of these protocols are optional if the platform does not support configuration
63 and the UEFI HII Image Protocol and the UEFI HII Font Protocol are optional if
64 the platform does not support a graphical console. As a result, the consumers
65 of this library much check the protocol pointers againt NULL before using them,
66 or use dependency expressions to guarantee that some of them are present before
67 assuming they are not NULL.
69 @param ImageHandle The firmware allocated handle for the EFI image.
70 @param SystemTable A pointer to the EFI System Table.
72 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
77 UefiHiiServicesLibConstructor (
78 IN EFI_HANDLE ImageHandle
,
79 IN EFI_SYSTEM_TABLE
*SystemTable
85 // Retrieve the pointer to the UEFI HII String Protocol
87 Status
= gBS
->LocateProtocol (&gEfiHiiStringProtocolGuid
, NULL
, (VOID
**) &gHiiString
);
88 ASSERT_EFI_ERROR (Status
);
91 // Retrieve the pointer to the UEFI HII Database Protocol
93 Status
= gBS
->LocateProtocol (&gEfiHiiDatabaseProtocolGuid
, NULL
, (VOID
**) &gHiiDatabase
);
94 ASSERT_EFI_ERROR (Status
);
97 // Retrieve the pointer to the UEFI HII Config Routing Protocol
99 Status
= gBS
->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid
, NULL
, (VOID
**) &gHiiConfigRouting
);
100 ASSERT_EFI_ERROR (Status
);
103 // Retrieve the pointer to the optional UEFI HII Font Protocol
105 gBS
->LocateProtocol (&gEfiHiiFontProtocolGuid
, NULL
, (VOID
**) &gHiiFont
);
108 // Retrieve the pointer to the optional UEFI HII Image Protocol
110 gBS
->LocateProtocol (&gEfiHiiImageProtocolGuid
, NULL
, (VOID
**) &gHiiImage
);