/** @file\r
File explorer related functions.\r
\r
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available under\r
-the terms and conditions of the BSD License that accompanies this distribution.\r
-The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php.\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
{\r
END_DEVICE_PATH_TYPE,\r
END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
- { \r
+ {\r
(UINT8) (END_DEVICE_PATH_LENGTH),\r
(UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r
}\r
\r
Buffer = NULL;\r
BufferSize = 0;\r
- \r
+\r
Status = FHand->GetInfo (\r
FHand,\r
InfoType,\r
\r
Size1 = StrSize (Str1);\r
Size2 = StrSize (Str2);\r
- \r
+\r
//\r
// Check overflow\r
//\r
if (((MAX_UINTN - Size1) < Size2) || ((MAX_UINTN - Size1 - Size2) < sizeof(CHAR16))) {\r
return NULL;\r
}\r
- \r
+\r
MaxLen = (Size1 + Size2 + sizeof (CHAR16))/ sizeof (CHAR16);\r
Str = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));\r
ASSERT (Str != NULL);\r
\r
- TmpStr = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16)); \r
+ TmpStr = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));\r
ASSERT (TmpStr != NULL);\r
\r
StrCpyS (Str, MaxLen, Str1);\r
//\r
\r
//\r
- // Use TmpStr as a backup, as StrCpyS in BaseLib does not handle copy of two strings \r
+ // Use TmpStr as a backup, as StrCpyS in BaseLib does not handle copy of two strings\r
// that overlap.\r
//\r
StrCpyS (TmpStr, MaxLen, Ptr + 3);\r
//\r
\r
//\r
- // Use TmpStr as a backup, as StrCpyS in BaseLib does not handle copy of two strings \r
+ // Use TmpStr as a backup, as StrCpyS in BaseLib does not handle copy of two strings\r
// that overlap.\r
//\r
StrCpyS (TmpStr, MaxLen, Ptr + 2);\r
}\r
\r
FreePool (TmpStr);\r
- \r
+\r
return Str;\r
}\r
\r
VolumeLabel,\r
MenuEntry->HelpString\r
);\r
- MenuEntry->DisplayStringToken = HiiSetString (\r
+ MenuEntry->DisplayStringToken = HiiSetString (\r
gFileExplorerPrivate.FeHiiHandle,\r
0,\r
MenuEntry->DisplayString,\r
\r
/**\r
Find the file handle from the input menu info.\r
- \r
+\r
@param MenuEntry Input Menu info.\r
@param RetFileHandle Return the file handle for the input device path.\r
- \r
+\r
@retval EFI_SUCESS Find the file handle success.\r
@retval Other Find the file handle failure.\r
**/\r
EFI_STATUS\r
LibGetFileHandleFromMenu (\r
- IN MENU_ENTRY *MenuEntry, \r
+ IN MENU_ENTRY *MenuEntry,\r
OUT EFI_FILE_HANDLE *RetFileHandle\r
)\r
{\r
\r
/**\r
Find the file handle from the input device path info.\r
- \r
+\r
@param RootDirectory Device path info.\r
@param RetFileHandle Return the file handle for the input device path.\r
@param ParentFileName Parent file name.\r
@param DeviceHandle Driver handle for this partition.\r
- \r
+\r
@retval EFI_SUCESS Find the file handle success.\r
@retval Other Find the file handle failure.\r
**/\r
EFI_STATUS\r
LibGetFileHandleFromDevicePath (\r
- IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, \r
+ IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory,\r
OUT EFI_FILE_HANDLE *RetFileHandle,\r
OUT UINT16 **ParentFileName,\r
OUT EFI_HANDLE *DeviceHandle\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
- \r
+\r
Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID**)&Volume);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
- \r
+\r
//\r
// Open the Volume to get the File System handle\r
//\r
*RetFileHandle = FileHandle;\r
return EFI_SUCCESS;\r
}\r
- \r
+\r
//\r
// Duplicate the device path to avoid the access to unaligned device path node.\r
// Because the device path consists of one or more FILE PATH MEDIA DEVICE PATH\r
Status = EFI_OUT_OF_RESOURCES;\r
goto Done;\r
}\r
- \r
+\r
//\r
// Parse each MEDIA_FILEPATH_DP node. There may be more than one, since the\r
// directory information and filename can be seperate. The goal is to inch\r
\r
/**\r
Find files under current directory.\r
- \r
+\r
All files and sub-directories in current directory\r
will be stored in DirectoryMenu for future use.\r
\r
- @param FileHandle Parent file handle. \r
+ @param FileHandle Parent file handle.\r
@param FileName Parent file name.\r
@param DeviceHandle Driver handle for this partition.\r
\r
} else {\r
NewMenuEntry->DisplayString = LibStrDuplicate (DirInfo->FileName);\r
}\r
- \r
+\r
NewMenuEntry->DisplayStringToken = HiiSetString (\r
gFileExplorerPrivate.FeHiiHandle,\r
0,\r
}\r
\r
/**\r
- Choose a file in the specified directory. \r
+ Choose a file in the specified directory.\r
\r
If user input NULL for the RootDirectory, will choose file in the system.\r
\r
//\r
Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **) &gFileExplorerPrivate.FormBrowser2);\r
ASSERT_EFI_ERROR (Status);\r
- \r
+\r
InitializeListHead (&gFileExplorerPrivate.FsOptionMenu->Head);\r
\r
return EFI_SUCCESS;\r
NULL\r
);\r
ASSERT_EFI_ERROR (Status);\r
- \r
+\r
HiiRemovePackages (gFileExplorerPrivate.FeHiiHandle);\r
+ gFileExplorerPrivate.FeDriverHandle = NULL;\r
}\r
\r
FreePool (gHiiVendorDevicePath);\r