Reviewed-by: Liming Gao <[email protected]> -----Original Message----- From: edk2-devel [mailto:[email protected]] On Behalf Of Eric Dong Sent: Wednesday, November 11, 2015 3:28 PM To: [email protected]; [email protected]; [email protected] Cc: Gao, Liming Subject: [edk2] [Patch] [Patch V3] MdeModulePkg DxeFileExplorerProtocol: Create wrapper file explorer library.
This library wrapper explorer protocol and produce the file explorer library. Cc: Liming Gao <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong <[email protected]> --- .../DxeFileExplorerProtocol.c | 88 +++++++++++++++++++++ .../DxeFileExplorerProtocol.inf | 41 ++++++++++ .../DxeFileExplorerProtocol.uni | Bin 0 -> 1950 bytes 3 files changed, 129 insertions(+) create mode 100644 MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.c create mode 100644 MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.inf create mode 100644 MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.uni diff --git a/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.c b/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.c new file mode 100644 index 0000000..1c22248 --- /dev/null +++ b/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtoc +++ ol.c @@ -0,0 +1,88 @@ +/** @file + Instance of file explorer Library based on gEfiFileExplorerProtocolGuid. + + Implement the file explorer library instance by wrap the interface + provided in the file explorer protocol. This protocol is defined as + the internal protocol related to this implementation, not in the + public spec. So, this library instance is only for this code base. + +Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR> +This program and the accompanying materials are licensed and made +available under the terms and conditions of the BSD License which +accompanies this distribution. The full text of the license may be +found at http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ +#include <Protocol/FileExplorer.h> + +#include <Library/FileExplorerLib.h> +#include <Library/DebugLib.h> + +EFI_FILE_EXPLORER_PROTOCOL *mProtocol = NULL; + +/** + The constructor function caches the pointer to file explorer protocol. + + The constructor function locates Print2 protocol from protocol database. + It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +FileExplorerConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status = SystemTable->BootServices->LocateProtocol ( + &gEfiFileExplorerProtocolGuid, + NULL, + (VOID**) &mProtocol + ); ASSERT_EFI_ERROR (Status); + ASSERT (mProtocol != NULL); + + return Status; +} + +/** + Choose a file in the specified directory. + + If user input NULL for the RootDirectory, will choose file in the system. + + If user input *File != NULL, function will return the allocate device + path info for the choosed file, caller has to free the memory after use it. + + @param RootDirectory Pointer to the root directory. + @param FileType The file type need to choose. + @param ChooseHandler Function pointer to the extra task need to do + after choose one file. + @param File Return the device path for the last time chosed file. + + @retval EFI_SUCESS Choose file success. + @retval EFI_INVALID_PARAMETER Both ChooseHandler and return device path are NULL + One of them must not NULL. + @retval Other errors Choose file failed. +**/ +EFI_STATUS +EFIAPI +ChooseFile ( + IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, + IN CHAR16 *FileType, OPTIONAL + IN CHOOSE_HANDLER ChooseHandler, OPTIONAL + OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL + ) +{ + return mProtocol->ChooseFile (RootDirectory, FileType, ChooseHandler, +File); } + diff --git a/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.inf b/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.inf new file mode 100644 index 0000000..a9b04c4 --- /dev/null +++ b/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtoc +++ ol.inf @@ -0,0 +1,41 @@ +## @file +# Library instance that implements File explorer Library class based on protocol gEfiFileExplorerProtocolGuid. +# +# Copyright (c) 2009 - 2015, Intel Corporation. All rights +reserved.<BR> # # This program and the accompanying materials # are +licensed and made available under the terms and conditions of the BSD +License # which accompanies this distribution. The full text of the +license may be found at # +http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" +BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DxeFileExplorerProtocol + MODULE_UNI_FILE = DxeFileExplorerProtocol.uni + FILE_GUID = 6806C45F-13C4-4274-B8A3-055EF641A060 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = FileExplorerLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER + CONSTRUCTOR = FileExplorerConstructor + +[Sources] + DxeFileExplorerProtocol.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + BaseLib + DebugLib + +[Protocols] + gEfiFileExplorerProtocolGuid ## CONSUMES + +[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, +Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER] + gEfiFileExplorerProtocolGuid \ No newline at end of file diff --git a/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.uni b/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.uni new file mode 100644 index 0000000000000000000000000000000000000000..3ecc8926f6c36b3150a0b12f33cdd21c20a30624 GIT binary patch literal 1950 zcmds&NpBND5QXcE#D8cx7eGl2NE|>2VUtN10kP#pfm1YI;*8`a8k;PC9{66h?Q!fN zxPq+Ss=HskdR0CC`J-x83$$nag1xs3%WZ5!du)%eYVR|ao)wnS?pWtGwYe==Pp!|% z!2FWc!uKY2<@YD-OtH<e9xpKiwp-tyfi<M<qW8I-aZC4lJ{#JA`3$tc-GbSI)~AiJ zj4W}^D<8?0hvwFe6Z;OEfgP?RTt&JXgM9$|idYLyj)+Z>J;CEs#+UY--)m+E%hd~e zW&6xik9X*-giwH?UdrUmruYn2V_&>WY(*+H=B~&!z1Y3Ay0z@x4$EL280D@{RAb~m zCZH%I(n|SIUNSgKC*?$Ycifv2QNSWr%0SL+3|bkz@~qoq_LN^`JLX`8uiFDZli4+M zRZK><R5t;A#Uf^R#U%QgIO`RPnCWD`)<;Ur$YvQq-P(4<S~Xa5DY@Rb7Jd5NXmdCS zQ5>RP@}<gE)IE4^=0&QC{RQ@zA#uLt%r>X{x<oDYE_%!Rv!w!JwAj#9b+jN8Z~R@U z!lJf1UwCwfL|>4f>X!C%EIpVHsJZ*z4?(%4m5OxiBQGLYlj>>M34P7Juuf4jprytR z)|C3{GD}?FuAMR_*i~N<q0~O*MI@YPJ92}W>R5e+QMf{_FxGvo)&2&jGxmkraF4;x zIMs4yr`S_ah0$>DEmq<#n|yXSt26Q%PaShs-oG(^Vn@vN{*tAa7)4@V*El75iWW_( zNj{Gr_yz?34pyDJG*#PM*GzmnQNMGL8enumOY9s*(o4$LP^$x<-~IN;q29oVyl3>P tI#t2}SYld%-M{h`t*n*$JC#&pZS+z7HP?B4NU1-oq;JCi_`g(Y`U?X%Izs>e literal 0 HcmV?d00001 -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

