X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ShellPkg%2FLibrary%2FUefiShellBcfgCommandLib%2FUefiShellBcfgCommandLib.c;h=bf35a35b985d00e32af4e4aa5d1cb285c7e9a014;hb=f86a5c346578a9503f7383c6eb77ce256f33b605;hp=d109ca29a781b1ac06eaf888ff633b87f805f520;hpb=40de6483ec902472dabf61332595194937f5c260;p=mirror_edk2.git diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c index d109ca29a7..bf35a35b98 100644 --- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c +++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c @@ -310,6 +310,7 @@ BcfgAdd( { EFI_STATUS Status; EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_DEVICE_PATH_PROTOCOL *DevPath; EFI_DEVICE_PATH_PROTOCOL *FilePath; CHAR16 *Str; UINT8 *TempByteBuffer; @@ -462,9 +463,9 @@ BcfgAdd( ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_DP), gShellBcfgHiiHandle, L"bcfg", Arg->FullName); ShellStatus = SHELL_UNSUPPORTED; } else { -/* if (UsePath) { - DevPath = DevicePath; + DevPath = DevicePath; + ShellStatus = SHELL_INVALID_PARAMETER; while (!IsDevicePathEnd(DevPath)) { if ((DevicePathType(DevPath) == MEDIA_DEVICE_PATH) && (DevicePathSubType(DevPath) == MEDIA_HARDDRIVE_DP)) { @@ -472,24 +473,15 @@ BcfgAdd( // // If we find it use it instead // - DevicePath = DevPath; + ShellStatus = SHELL_SUCCESS; + FilePath = DuplicateDevicePath (DevPath); break; } DevPath = NextDevicePathNode(DevPath); } - // - // append the file - // - for(StringWalker=Arg->FullName; *StringWalker != CHAR_NULL && *StringWalker != ':'; StringWalker++); - FileNode = FileDevicePath(NULL, StringWalker+1); - FilePath = AppendDevicePath(DevicePath, FileNode); - FreePool(FileNode); } else { -*/ FilePath = DuplicateDevicePath(DevicePath); -/* } -*/ FreePool(DevicePath); } } @@ -1048,13 +1040,13 @@ BcfgDisplayDump( UINTN BufferSize; CHAR16 VariableName[12]; UINTN LoopVar; - UINTN LoopVar2; CHAR16 *DevPathString; VOID *FilePathList; UINTN Errors; EFI_LOAD_OPTION *LoadOption; CHAR16 *Description; UINTN DescriptionSize; + UINTN OptionalDataOffset; if (OrderCount == 0) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_BCFG_NONE), gShellBcfgHiiHandle, L"bcfg"); @@ -1111,13 +1103,17 @@ BcfgDisplayDump( } LoadOption = (EFI_LOAD_OPTION *)Buffer; - Description = (CHAR16 *)(&LoadOption->FilePathListLength + 1); + Description = (CHAR16*)(Buffer + sizeof (EFI_LOAD_OPTION)); DescriptionSize = StrSize (Description); if (LoadOption->FilePathListLength != 0) { FilePathList = (UINT8 *)Description + DescriptionSize; DevPathString = ConvertDevicePathToText(FilePathList, TRUE, FALSE); } + + OptionalDataOffset = sizeof *LoadOption + DescriptionSize + + LoadOption->FilePathListLength; + ShellPrintHiiEx( -1, -1, @@ -1128,21 +1124,15 @@ BcfgDisplayDump( VariableName, Description, DevPathString, - (DescriptionSize + LoadOption->FilePathListLength + 6) <= BufferSize?L'N':L'Y'); - if (VerboseOutput) { - for (LoopVar2 = (DescriptionSize + LoadOption->FilePathListLength + 6);LoopVar2= BufferSize ? L'N' : L'Y' + ); + if (VerboseOutput && (OptionalDataOffset < BufferSize)) { + DumpHex ( + 2, // Indent + 0, // Offset (displayed) + BufferSize - OptionalDataOffset, // DataSize + Buffer + OptionalDataOffset // UserData + ); } Cleanup: