MdeModulePkg DxeFileExplorerProtocol: Change file format which has mixed file format.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19296 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Eric Dong
2015-12-16 03:20:21 +00:00
committed by ydong10
parent 3c8b6a5479
commit 426ddd0b6a
2 changed files with 133 additions and 133 deletions

View File

@ -1,93 +1,93 @@
/** @file /** @file
Instance of file explorer Library based on gEfiFileExplorerProtocolGuid. Instance of file explorer Library based on gEfiFileExplorerProtocolGuid.
Implement the file explorer library instance by wrap the interface Implement the file explorer library instance by wrap the interface
provided in the file explorer protocol. This protocol is defined as the internal 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 protocol related to this implementation, not in the public spec. So, this
library instance is only for this code base. library instance is only for this code base.
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include <Uefi.h> #include <Uefi.h>
#include <Base.h> #include <Base.h>
#include <Protocol/FileExplorer.h> #include <Protocol/FileExplorer.h>
#include <Library/FileExplorerLib.h> #include <Library/FileExplorerLib.h>
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
EFI_FILE_EXPLORER_PROTOCOL *mProtocol = NULL; EFI_FILE_EXPLORER_PROTOCOL *mProtocol = NULL;
/** /**
The constructor function caches the pointer to file explorer protocol. The constructor function caches the pointer to file explorer protocol.
The constructor function locates Print2 protocol from protocol database. The constructor function locates Print2 protocol from protocol database.
It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. 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 ImageHandle The firmware allocated handle for the EFI image.
@param SystemTable A pointer to the EFI System Table. @param SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FileExplorerConstructor ( FileExplorerConstructor (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = SystemTable->BootServices->LocateProtocol ( Status = SystemTable->BootServices->LocateProtocol (
&gEfiFileExplorerProtocolGuid, &gEfiFileExplorerProtocolGuid,
NULL, NULL,
(VOID**) &mProtocol (VOID**) &mProtocol
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
ASSERT (mProtocol != NULL); ASSERT (mProtocol != NULL);
return Status; return Status;
} }
/** /**
Choose a file in the specified directory. Choose a file in the specified directory.
If user input NULL for the RootDirectory, will choose file in the system. 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 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. info for the choosed file, caller has to free the memory after use it.
@param RootDirectory Pointer to the root directory. @param RootDirectory Pointer to the root directory.
@param FileType The file type need to choose. @param FileType The file type need to choose.
@param ChooseHandler Function pointer to the extra task need to do @param ChooseHandler Function pointer to the extra task need to do
after choose one file. after choose one file.
@param File Return the device path for the last time chosed file. @param File Return the device path for the last time chosed file.
@retval EFI_SUCESS Choose file success. @retval EFI_SUCESS Choose file success.
@retval EFI_INVALID_PARAMETER Both ChooseHandler and return device path are NULL @retval EFI_INVALID_PARAMETER Both ChooseHandler and return device path are NULL
One of them must not NULL. One of them must not NULL.
@retval Other errors Choose file failed. @retval Other errors Choose file failed.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ChooseFile ( ChooseFile (
IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory,
IN CHAR16 *FileType, OPTIONAL IN CHAR16 *FileType, OPTIONAL
IN CHOOSE_HANDLER ChooseHandler, OPTIONAL IN CHOOSE_HANDLER ChooseHandler, OPTIONAL
OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL
) )
{ {
return mProtocol->ChooseFile (RootDirectory, FileType, ChooseHandler, File); return mProtocol->ChooseFile (RootDirectory, FileType, ChooseHandler, File);
} }

View File

@ -1,41 +1,41 @@
## @file ## @file
# Library instance that implements File explorer Library class based on protocol gEfiFileExplorerProtocolGuid. # Library instance that implements File explorer Library class based on protocol gEfiFileExplorerProtocolGuid.
# #
# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
# #
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # 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 # which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php # http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #
# #
## ##
[Defines] [Defines]
INF_VERSION = 0x00010005 INF_VERSION = 0x00010005
BASE_NAME = DxeFileExplorerProtocol BASE_NAME = DxeFileExplorerProtocol
MODULE_UNI_FILE = DxeFileExplorerProtocol.uni MODULE_UNI_FILE = DxeFileExplorerProtocol.uni
FILE_GUID = 6806C45F-13C4-4274-B8A3-055EF641A060 FILE_GUID = 6806C45F-13C4-4274-B8A3-055EF641A060
MODULE_TYPE = DXE_DRIVER MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0 VERSION_STRING = 1.0
LIBRARY_CLASS = FileExplorerLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER LIBRARY_CLASS = FileExplorerLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
CONSTRUCTOR = FileExplorerConstructor CONSTRUCTOR = FileExplorerConstructor
[Sources] [Sources]
DxeFileExplorerProtocol.c DxeFileExplorerProtocol.c
[Packages] [Packages]
MdePkg/MdePkg.dec MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec MdeModulePkg/MdeModulePkg.dec
[LibraryClasses] [LibraryClasses]
BaseLib BaseLib
DebugLib DebugLib
[Protocols] [Protocols]
gEfiFileExplorerProtocolGuid ## CONSUMES gEfiFileExplorerProtocolGuid ## CONSUMES
[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER] [Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]
gEfiFileExplorerProtocolGuid gEfiFileExplorerProtocolGuid