2 Language related HII Library implementation.
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 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
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.
16 #include "InternalHiiLib.h"
19 Retrieves a pointer to the a Null-terminated ASCII string containing the list
20 of languages that an HII handle in the HII Database supports. The returned
21 string is allocated using AllocatePool(). The caller is responsible for freeing
22 the returned string using FreePool(). The format of the returned string follows
23 the language format assumed the HII Database.
25 If HiiHandle is NULL, then ASSERT().
27 @param[in] HiiHandle A handle that was previously registered in the HII Database.
29 @retval NULL HiiHandle is not registered in the HII database
30 @retval NULL There are not enough resources available to retrieve the supported
32 @retval NULL The list of supported languages could not be retrieved.
33 @retval Other A pointer to the Null-terminated ASCII string of supported languages.
38 HiiGetSupportedLanguages (
39 IN EFI_HII_HANDLE HiiHandle
44 CHAR8 TempSupportedLanguages
;
45 CHAR8
*SupportedLanguages
;
47 ASSERT (HiiHandle
!= NULL
);
50 // Retrieve the size required for the supported languages buffer.
53 Status
= gHiiString
->GetLanguages (gHiiString
, HiiHandle
, &TempSupportedLanguages
, &LanguageSize
);
56 // If GetLanguages() returns EFI_SUCCESS for a zero size,
57 // then there are no supported languages registered for HiiHandle. If GetLanguages()
58 // returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is not present
59 // in the HII Database
61 if (Status
!= EFI_BUFFER_TOO_SMALL
) {
63 // Return NULL if the size can not be retrieved, or if HiiHandle is not in the HII Database
69 // Allocate the supported languages buffer.
71 SupportedLanguages
= AllocateZeroPool (LanguageSize
);
72 if (SupportedLanguages
== NULL
) {
74 // Return NULL if allocation fails.
80 // Retrieve the supported languages string
82 Status
= gHiiString
->GetLanguages (gHiiString
, HiiHandle
, SupportedLanguages
, &LanguageSize
);
83 if (EFI_ERROR (Status
)) {
85 // Free the buffer and return NULL if the supported languages can not be retrieved.
87 FreePool (SupportedLanguages
);
92 // Return the Null-terminated ASCII string of supported languages
94 return SupportedLanguages
;