X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ShellPkg%2FLibrary%2FUefiShellCommandLib%2FConsistMapping.c;h=86e8dc59a8951bab39356886c7ec2428e32d6110;hp=368d6a487b87cee5618c25012a81c68da959f488;hb=e9fc53878117779eeb35715666573d307e069380;hpb=41089802d5046d5d4790bb64ae35f87db3115cb2 diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c index 368d6a487b..86e8dc59a8 100644 --- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c +++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c @@ -1,7 +1,7 @@ /** @file Main file for support of shell consist mapping. - Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
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 @@ -16,6 +16,10 @@ #include #include #include +#include +#include + + typedef enum { MTDTypeUnknown, @@ -116,7 +120,7 @@ CatPrint ( ASSERT (Str->Str != NULL); } - StrnCat (Str->Str, AppendStr, StringSize/sizeof(CHAR16) - 1 - StrLen(Str->Str)); + StrCatS (Str->Str, StringSize/sizeof(CHAR16), AppendStr); Str->Len = StringSize; FreePool (AppendStr); @@ -1349,20 +1353,22 @@ ShellCommandConsistMappingInitialize ( OUT EFI_DEVICE_PATH_PROTOCOL ***Table ) { - EFI_HANDLE *HandleBuffer; - UINTN HandleNum; - UINTN HandleLoop; - EFI_DEVICE_PATH_PROTOCOL **TempTable; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_DEVICE_PATH_PROTOCOL *HIDevicePath; - UINTN Index; - EFI_STATUS Status; + EFI_HANDLE *HandleBuffer; + UINTN HandleNum; + UINTN HandleLoop; + EFI_DEVICE_PATH_PROTOCOL **TempTable; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_DEVICE_PATH_PROTOCOL *HIDevicePath; + EFI_BLOCK_IO_PROTOCOL *BlockIo; + EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem; + UINTN Index; + EFI_STATUS Status; HandleBuffer = NULL; Status = gBS->LocateHandleBuffer ( - AllHandles, - NULL, + ByProtocol, + &gEfiDevicePathProtocolGuid, NULL, &HandleNum, &HandleBuffer @@ -1385,6 +1391,20 @@ ShellCommandConsistMappingInitialize ( continue; } + Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], + &gEfiBlockIoProtocolGuid, + (VOID **)&BlockIo + ); + if (EFI_ERROR(Status)) { + Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], + &gEfiSimpleFileSystemProtocolGuid, + (VOID **)&SimpleFileSystem + ); + if (EFI_ERROR(Status)) { + continue; + } + } + for (Index = 0; TempTable[Index] != NULL; Index++) { if (DevicePathCompare (&TempTable[Index], &HIDevicePath) == 0) { FreePool (HIDevicePath);