]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Application/Ping6/Ping6.c
NetworkPkg: Support print help information using -? command.
[mirror_edk2.git] / NetworkPkg / Application / Ping6 / Ping6.c
index 596ee3b00744638ad9c843827d9de6843086621d..f1685f710b1d673bd08ab40c79a7e5a116d0aaa0 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation for Ping6 application.\r
 \r
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -19,6 +19,7 @@
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiHiiServicesLib.h>\r
 #include <Library/HiiLib.h>\r
 #include <Library/NetLib.h>\r
 \r
@@ -42,10 +43,6 @@ SHELL_PARAM_ITEM    Ping6ParamList[] = {
     L"-s",\r
     TypeValue\r
   },\r
-  {\r
-    L"-?",\r
-    TypeFlag\r
-  },\r
   {\r
     NULL,\r
     TypeMax\r
@@ -1059,11 +1056,36 @@ InitializePing6 (
   CONST CHAR16        *ValueStr;\r
   CONST CHAR16        *ValueStrPtr;\r
   UINTN               NonOptionCount;\r
+  EFI_HII_PACKAGE_LIST_HEADER     *PackageList;\r
 \r
   //\r
-  // Register our string package with HII and return the handle to it.\r
+  // Retrieve HII package list from ImageHandle\r
   //\r
-  mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, Ping6Strings, NULL);\r
+  Status = gBS->OpenProtocol (\r
+                  ImageHandle,\r
+                  &gEfiHiiPackageListProtocolGuid,\r
+                  (VOID **) &PackageList,\r
+                  ImageHandle,\r
+                  NULL,\r
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Publish HII package list to HII Database.\r
+  //\r
+  Status = gHiiDatabase->NewPackageList (\r
+                          gHiiDatabase,\r
+                          PackageList,\r
+                          NULL,\r
+                          &mHiiHandle\r
+                          );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+  \r
   ASSERT (mHiiHandle != NULL);\r
 \r
   Status = ShellCommandLineParseEx (Ping6ParamList, &ParamPackage, NULL, TRUE, FALSE);\r
@@ -1072,11 +1094,6 @@ InitializePing6 (
     goto ON_EXIT;\r
   }\r
 \r
-  if (ShellCommandLineGetFlag (ParamPackage, L"-?")) {\r
-    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_HELP), mHiiHandle);\r
-    goto ON_EXIT;\r
-  }\r
-\r
   SendNumber = 10;\r
   BufferSize = 16;\r
 \r