VirtualBox

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

最後變更 在這個檔案從95057是 80721,由 vboxsync 提交於 6 年 前

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

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

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