diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-08-18 07:47:51 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-08-18 07:47:51 +0000 |
commit | 55a9663bdea82251406a82c4eb0fdf81993a9664 (patch) | |
tree | 6f7e80f30736e811962a7192a64cb2b5b500c29e /MdePkg/Library | |
parent | d00afc4ef8ca8eaaf2debec3d9f40fa3ade3fae6 (diff) | |
download | edk2-platforms-55a9663bdea82251406a82c4eb0fdf81993a9664.tar.xz |
Add IfrLibCreatePopUp2 and HiiLibExportPackageLists.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5663 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library')
-rw-r--r-- | MdePkg/Library/HiiLib/HiiLib.c | 124 | ||||
-rw-r--r-- | MdePkg/Library/IfrSupportLib/UefiIfrForm.c | 47 |
2 files changed, 164 insertions, 7 deletions
diff --git a/MdePkg/Library/HiiLib/HiiLib.c b/MdePkg/Library/HiiLib/HiiLib.c index 2eae82fec8..efae6780bc 100644 --- a/MdePkg/Library/HiiLib/HiiLib.c +++ b/MdePkg/Library/HiiLib/HiiLib.c @@ -506,6 +506,130 @@ HiiLibDevicePathToHiiHandle ( }
/**
+ Exports the contents of one or all package lists in the HII database into a buffer.
+
+ If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database,
+ then ASSERT.
+ If PackageListHeader is NULL, then ASSERT.
+ If PackageListSize is NULL, then ASSERT.
+
+ @param Handle The HII Handle.
+ @param PackageListHeader A pointer to a buffer that will contain the results of
+ the export function.
+ @param PackageListSize On output, the length of the buffer that is required for the exported data.
+
+ @retval EFI_SUCCESS Package exported.
+
+ @retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiLibExportPackageLists (
+ IN EFI_HII_HANDLE Handle,
+ OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,
+ OUT UINTN *PackageListSize
+ )
+{
+ EFI_STATUS Status;
+ UINTN Size;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageListHdr;
+
+ ASSERT (PackageListSize != NULL);
+ ASSERT (PackageListHeader != NULL);
+
+ LocateHiiProtocols ();
+
+ if (Handle != NULL) {
+ ASSERT (IsHiiHandleRegistered (Handle));
+ }
+
+ Size = 0;
+ PackageListHdr = NULL;
+ Status = mHiiDatabaseProt->ExportPackageLists (
+ mHiiDatabaseProt,
+ Handle,
+ &Size,
+ PackageListHdr
+ );
+ ASSERT_EFI_ERROR (Status != EFI_BUFFER_TOO_SMALL);
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ PackageListHdr = AllocateZeroPool (Size);
+
+ if (PackageListHeader == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ } else {
+ Status = mHiiDatabaseProt->ExportPackageLists (
+ mHiiDatabaseProt,
+ Handle,
+ &Size,
+ PackageListHdr
+ );
+ }
+ }
+
+ if (!EFI_ERROR (Status)) {
+ *PackageListHeader = PackageListHdr;
+ *PackageListSize = Size;
+ } else {
+ FreePool (PackageListHdr);
+ }
+
+ return Status;
+}
+
+
+EFI_STATUS
+EFIAPI
+HiiLibListPackageLists (
+ IN UINT8 PackageType,
+ IN CONST EFI_GUID *PackageGuid,
+ IN OUT UINTN *HandleBufferLength,
+ OUT EFI_HII_HANDLE **HandleBuffer
+ )
+{
+ EFI_STATUS Status;
+
+ ASSERT (HandleBufferLength != NULL);
+ ASSERT (HandleBuffer != NULL);
+
+ *HandleBufferLength = 0;
+ *HandleBuffer = NULL;
+
+ LocateHiiProtocols ();
+
+ Status = mHiiDatabaseProt->ListPackageLists (
+ mHiiDatabaseProt,
+ PackageType,
+ PackageGuid,
+ HandleBufferLength,
+ *HandleBuffer
+ );
+ if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
+ //
+ // No packages is registered to UEFI HII Database, just return EFI_SUCCESS.
+ //
+ //
+ return Status;
+ }
+
+ *HandleBuffer = AllocateZeroPool (*HandleBufferLength);
+
+ if (*HandleBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ return mHiiDatabaseProt->ListPackageLists (
+ mHiiDatabaseProt,
+ PackageType,
+ PackageGuid,
+ HandleBufferLength,
+ *HandleBuffer
+ );
+
+}
+/**
This function check if the Hii Handle is a valid handle registered
in the HII database.
diff --git a/MdePkg/Library/IfrSupportLib/UefiIfrForm.c b/MdePkg/Library/IfrSupportLib/UefiIfrForm.c index 179fc1cb9f..504b88d468 100644 --- a/MdePkg/Library/IfrSupportLib/UefiIfrForm.c +++ b/MdePkg/Library/IfrSupportLib/UefiIfrForm.c @@ -36,11 +36,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT16 mFakeConfigHdr[] = L"GUID=00000000000 **/ EFI_STATUS EFIAPI -IfrLibCreatePopUp ( +IfrLibCreatePopUp2 ( IN UINTN NumberOfLines, OUT EFI_INPUT_KEY *KeyValue, - IN CHAR16 *String, - ... + IN VA_LIST Marker ) { UINTN Index; @@ -54,7 +53,6 @@ IfrLibCreatePopUp ( UINTN BottomRow; UINTN DimensionsWidth; UINTN DimensionsHeight; - VA_LIST Marker; EFI_INPUT_KEY Key; UINTN LargestString; CHAR16 *StackString; @@ -66,7 +64,10 @@ IfrLibCreatePopUp ( EFI_EVENT WaitList[2]; UINTN CurrentAttribute; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut; + CHAR16 *String; + String = VA_ARG (Marker, CHAR16 *); + if ((KeyValue == NULL) || (String == NULL)) { return EFI_INVALID_PARAMETER; } @@ -95,7 +96,6 @@ IfrLibCreatePopUp ( LargestString = StrLen (String); StringArray[0] = String; - VA_START (Marker, String); for (Index = 1; Index < NumberOfLines; Index++) { StackString = VA_ARG (Marker, CHAR16 *); @@ -109,7 +109,6 @@ IfrLibCreatePopUp ( LargestString = StringLen; } } - VA_END (Marker); if ((LargestString + 2) > DimensionsWidth) { LargestString = DimensionsWidth - 2; @@ -212,10 +211,44 @@ IfrLibCreatePopUp ( ConOut->SetAttribute (ConOut, CurrentAttribute); ConOut->EnableCursor (ConOut, TRUE); + return Status;} + + +/** + Draw a dialog and return the selected key. + + @param NumberOfLines The number of lines for the dialog box + @param KeyValue The EFI_KEY value returned if HotKey is TRUE.. + @param String Pointer to the first string in the list + @param ... A series of (quantity == NumberOfLines - 1) text + strings which will be used to construct the dialog + box + + @retval EFI_SUCCESS Displayed dialog and received user interaction + @retval EFI_INVALID_PARAMETER One of the parameters was invalid. + +**/ +EFI_STATUS +EFIAPI +IfrLibCreatePopUp ( + IN UINTN NumberOfLines, + OUT EFI_INPUT_KEY *KeyValue, + IN CHAR16 *String, + ... + ) +{ + EFI_STATUS Status; + VA_LIST Marker; + + VA_START (Marker, KeyValue); + + Status = IfrLibCreatePopUp2 (NumberOfLines, KeyValue, Marker); + + VA_END (Marker); + return Status; } - /** Swap bytes in the buffer. This is a internal function. |