VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/UefiHiiLib/HiiLanguage.c@ 99404

最後變更 在這個檔案從99404是 99404,由 vboxsync 提交於 2 年 前

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.5 KB
 
1/** @file
2 Language related HII Library implementation.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include "InternalHiiLib.h"
10
11/**
12 Retrieves a pointer to the a Null-terminated ASCII string containing the list
13 of languages that an HII handle in the HII Database supports. The returned
14 string is allocated using AllocatePool(). The caller is responsible for freeing
15 the returned string using FreePool(). The format of the returned string follows
16 the language format assumed the HII Database.
17
18 If HiiHandle is NULL, then ASSERT().
19
20 @param[in] HiiHandle A handle that was previously registered in the HII Database.
21
22 @retval NULL HiiHandle is not registered in the HII database
23 @retval NULL There are not enough resources available to retrieve the supported
24 languages.
25 @retval NULL The list of supported languages could not be retrieved.
26 @retval Other A pointer to the Null-terminated ASCII string of supported languages.
27
28**/
29CHAR8 *
30EFIAPI
31HiiGetSupportedLanguages (
32 IN EFI_HII_HANDLE HiiHandle
33 )
34{
35 EFI_STATUS Status;
36 UINTN LanguageSize;
37 CHAR8 TempSupportedLanguages;
38 CHAR8 *SupportedLanguages;
39
40 ASSERT (HiiHandle != NULL);
41
42 //
43 // Retrieve the size required for the supported languages buffer.
44 //
45 LanguageSize = 0;
46 Status = gHiiString->GetLanguages (gHiiString, HiiHandle, &TempSupportedLanguages, &LanguageSize);
47
48 //
49 // If GetLanguages() returns EFI_SUCCESS for a zero size,
50 // then there are no supported languages registered for HiiHandle. If GetLanguages()
51 // returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is not present
52 // in the HII Database
53 //
54 if (Status != EFI_BUFFER_TOO_SMALL) {
55 //
56 // Return NULL if the size can not be retrieved, or if HiiHandle is not in the HII Database
57 //
58 return NULL;
59 }
60
61 //
62 // Allocate the supported languages buffer.
63 //
64 SupportedLanguages = AllocateZeroPool (LanguageSize);
65 if (SupportedLanguages == NULL) {
66 //
67 // Return NULL if allocation fails.
68 //
69 return NULL;
70 }
71
72 //
73 // Retrieve the supported languages string
74 //
75 Status = gHiiString->GetLanguages (gHiiString, HiiHandle, SupportedLanguages, &LanguageSize);
76 if (EFI_ERROR (Status)) {
77 //
78 // Free the buffer and return NULL if the supported languages can not be retrieved.
79 //
80 FreePool (SupportedLanguages);
81 return NULL;
82 }
83
84 //
85 // Return the Null-terminated ASCII string of supported languages
86 //
87 return SupportedLanguages;
88}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette