summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2018-07-11 16:35:02 +0800
committerStar Zeng <star.zeng@intel.com>2018-07-23 09:17:19 +0800
commit5410502f6d7e4bb786ccd6c30c8662ed217bcaba (patch)
tree22cd787c072d31680f607057b7a743ee2f8065cc /MdeModulePkg
parenta10def91653163dbc6a38a609a87b370e9035654 (diff)
downloadedk2-5410502f6d7e4bb786ccd6c30c8662ed217bcaba.tar.gz
edk2-5410502f6d7e4bb786ccd6c30c8662ed217bcaba.tar.bz2
edk2-5410502f6d7e4bb786ccd6c30c8662ed217bcaba.zip
MdeModulePkg CapsuleApp: Check Arg count for -P GET option
Also add help info for CapsuleApp -P GET option. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Application/CapsuleApp/CapsuleApp.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
index e9be39fd71..80b66bc6f3 100644
--- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
+++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
@@ -740,7 +740,8 @@ PrintUsage (
Print(L" which is defined in UEFI specification.\n");
Print(L" -C: Clear capsule report variable (EFI_CAPSULE_REPORT_GUID),\n");
Print(L" which is defined in UEFI specification.\n");
- Print(L" -P: Dump UEFI FMP protocol info.\n");
+ Print(L" -P: Dump UEFI FMP protocol info, or get image with specified\n");
+ Print(L" ImageTypeId and index to a file if 'GET' option is used.\n");
Print(L" -E: Dump UEFI ESRT table info.\n");
Print(L" -G: Convert a BMP file to be an UX capsule,\n");
Print(L" according to Windows Firmware Update document\n");
@@ -820,7 +821,15 @@ UefiMain (
DumpFmpData();
}
if (Argc >= 3) {
- if (StrCmp(Argv[2], L"GET") == 0) {
+ if (StrCmp(Argv[2], L"GET") != 0) {
+ Print(L"CapsuleApp: Unrecognized option(%s).\n", Argv[2]);
+ return EFI_UNSUPPORTED;
+ } else {
+ if (Argc != 7) {
+ Print(L"CapsuleApp: Incorrect parameter count.\n");
+ return EFI_UNSUPPORTED;
+ }
+
EFI_GUID ImageTypeId;
UINTN ImageIndex;
//
@@ -832,9 +841,11 @@ UefiMain (
return EFI_INVALID_PARAMETER;
}
ImageIndex = StrDecimalToUintn(Argv[4]);
- if (StrCmp(Argv[5], L"-O") == 0) {
- DumpFmpImage(&ImageTypeId, ImageIndex, Argv[6]);
+ if (StrCmp(Argv[5], L"-O") != 0) {
+ Print(L"CapsuleApp: NO output file name.\n");
+ return EFI_UNSUPPORTED;
}
+ DumpFmpImage(&ImageTypeId, ImageIndex, Argv[6]);
}
}
return EFI_SUCCESS;