/** @file\r
File explorer related functions.\r
\r
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\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
)\r
{\r
UINTN NoSimpleFsHandles;\r
- UINTN NoLoadFileHandles;\r
EFI_HANDLE *SimpleFsHandle;\r
- EFI_HANDLE *LoadFileHandle;\r
UINT16 *VolumeLabel;\r
UINTN Index;\r
EFI_STATUS Status;\r
EFI_FILE_SYSTEM_VOLUME_LABEL *Info;\r
\r
NoSimpleFsHandles = 0;\r
- NoLoadFileHandles = 0;\r
OptionNumber = 0;\r
\r
//\r
FreePool (SimpleFsHandle);\r
}\r
\r
- //\r
- // Searching for handles that support Load File protocol\r
- //\r
- Status = gBS->LocateHandleBuffer (\r
- ByProtocol,\r
- &gEfiLoadFileProtocolGuid,\r
- NULL,\r
- &NoLoadFileHandles,\r
- &LoadFileHandle\r
- );\r
-\r
- if (!EFI_ERROR (Status)) {\r
- for (Index = 0; Index < NoLoadFileHandles; Index++) {\r
- MenuEntry = LibCreateMenuEntry ();\r
- if (NULL == MenuEntry) {\r
- FreePool (LoadFileHandle);\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
- FileContext = (FILE_CONTEXT *) MenuEntry->VariableContext;\r
- FileContext->DeviceHandle = LoadFileHandle[Index];\r
- FileContext->IsRoot = TRUE;\r
-\r
- FileContext->DevicePath = DevicePathFromHandle (FileContext->DeviceHandle);\r
- FileContext->FileName = LibDevicePathToStr (FileContext->DevicePath);\r
-\r
- MenuEntry->HelpString = LibDevicePathToStr (FileContext->DevicePath);\r
- MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR);\r
- ASSERT (MenuEntry->DisplayString != NULL);\r
- UnicodeSPrint (\r
- MenuEntry->DisplayString,\r
- MAX_CHAR,\r
- L"Load File [%s]",\r
- MenuEntry->HelpString\r
- );\r
- MenuEntry->DisplayStringToken = HiiSetString (\r
- gFileExplorerPrivate.FeHiiHandle,\r
- 0,\r
- MenuEntry->DisplayString,\r
- NULL\r
- );\r
-\r
- OptionNumber++;\r
- InsertTailList (&gFileExplorerPrivate.FsOptionMenu->Head, &MenuEntry->Link);\r
- }\r
- }\r
-\r
- if (NoLoadFileHandles != 0) {\r
- FreePool (LoadFileHandle);\r
- }\r
-\r
gFileExplorerPrivate.FsOptionMenu->MenuNumber = OptionNumber;\r
\r
return EFI_SUCCESS;\r