- Status = FvProtocol->GetNextFile (FvProtocol, Key, &FileType, &NameGuid, &Attributes, &Size);\r
- if (!EFI_ERROR (Status)) {\r
- UiSection = NULL;\r
- FileStatus = FvProtocol->ReadSection (\r
- FvProtocol,\r
- &NameGuid,\r
- EFI_SECTION_USER_INTERFACE,\r
- 0,\r
- (VOID **)&UiSection,\r
- &Size,\r
- &Authentication\r
- );\r
- if (!EFI_ERROR (FileStatus)) {\r
- if (StrnCmp (FilePath, UiSection, UiStringLen) == 0) {\r
- //\r
- // We found a UiString match.\r
- //\r
- Status = gBS->HandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);\r
-\r
- // Generate the Device Path for the file\r
- //DevicePath = DuplicateDevicePath(FvDevicePath);\r
- EfiInitializeFwVolDevicepathNode (&FileDevicePath, &NameGuid);\r
- *EfiAppDevicePath = AppendDevicePathNode (FvDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&FileDevicePath);\r
-\r
- FreePool (Key);\r
+ // Allocate Key\r
+ Key = AllocatePool (FvInstance->KeySize);\r
+ ASSERT (Key != NULL);\r
+ ZeroMem (Key, FvInstance->KeySize);\r
+\r
+ do {\r
+ // Search in all files\r
+ FileType = EFI_FV_FILETYPE_ALL;\r
+\r
+ Status = FvInstance->GetNextFile (FvInstance, Key, &FileType, &NameGuid, &Attributes, &Size);\r
+ if (!EFI_ERROR (Status)) {\r
+ UiSection = NULL;\r
+ FileStatus = FvInstance->ReadSection (\r
+ FvInstance,\r
+ &NameGuid,\r
+ EFI_SECTION_USER_INTERFACE,\r
+ 0,\r
+ (VOID **)&UiSection,\r
+ &Size,\r
+ &Authentication\r
+ );\r
+ if (!EFI_ERROR (FileStatus)) {\r
+ if (StrnCmp (EfiAppName, UiSection, UiStringLen) == 0) {\r
+ //\r
+ // We found a UiString match.\r
+ //\r
+ Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);\r
+\r
+ // Generate the Device Path for the file\r
+ EfiInitializeFwVolDevicepathNode (&FileDevicePath, &NameGuid);\r
+ *DevicePath = AppendDevicePathNode (FvDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&FileDevicePath);\r
+ ASSERT (*DevicePath != NULL);\r
+\r
+ FreePool (Key);\r
+ FreePool (UiSection);\r
+ FreePool (HandleBuffer);\r
+ return FileStatus;\r
+ }\r