]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c
ShellPkg/dp: Convert from NULL class library to Dynamic Command
[mirror_edk2.git] / ShellPkg / DynamicCommand / DpDynamicCommand / DpApp.c
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c
new file mode 100644 (file)
index 0000000..f96209b
--- /dev/null
@@ -0,0 +1,53 @@
+/** @file\r
+  Entrypoint of "dp" shell standalone application.\r
+\r
+  Copyright (c) 2017, 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
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+#include "Dp.h"\r
+\r
+//\r
+// String token ID of help message text.\r
+// Shell supports to find help message in the resource section of an application image if\r
+// .MAN file is not found. This global variable is added to make build tool recognizes\r
+// that the help string is consumed by user and then build tool will add the string into\r
+// the resource section. Thus the application can use '-?' option to show help message in\r
+// Shell.\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_DP);\r
+\r
+/**\r
+  Entry point of Tftp standalone application.\r
+\r
+  @param ImageHandle            The image handle of the process.\r
+  @param SystemTable            The EFI System Table pointer.\r
+\r
+  @retval EFI_SUCCESS           Tftp command is executed sucessfully.\r
+  @retval EFI_ABORTED           HII package was failed to initialize.\r
+  @retval others                Other errors when executing tftp command.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DpAppInitialize (\r
+  IN EFI_HANDLE               ImageHandle,\r
+  IN EFI_SYSTEM_TABLE         *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS                  Status;\r
+  mDpHiiHandle = InitializeHiiPackage (ImageHandle);\r
+  if (mDpHiiHandle == NULL) {\r
+    return EFI_ABORTED;\r
+  }\r
+\r
+  Status = (EFI_STATUS)RunDp (ImageHandle, SystemTable);\r
+  HiiRemovePackages (mDpHiiHandle);\r
+  return Status;\r
+}\r