Since Shell supports finding help information from resource section
of application image. We enhance the HelloWorld to add help information
string. After the HelloWorld are loaded in system the help string will
be stored in resource section of the application image.

Cc: Feng Tian <[email protected]>
Cc: Jaben Carsey <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Ruiyu Ni <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
---
 MdeModulePkg/Application/HelloWorld/HelloWorld.c   |  6 ++++-
 MdeModulePkg/Application/HelloWorld/HelloWorld.inf |  8 ++++++-
 .../Application/HelloWorld/HelloWorldStr.uni       | 27 ++++++++++++++++++++++
 3 files changed, 39 insertions(+), 2 deletions(-)
 create mode 100644 MdeModulePkg/Application/HelloWorld/HelloWorldStr.uni

diff --git a/MdeModulePkg/Application/HelloWorld/HelloWorld.c 
b/MdeModulePkg/Application/HelloWorld/HelloWorld.c
index 1821b2d..197fe5d 100644
--- a/MdeModulePkg/Application/HelloWorld/HelloWorld.c
+++ b/MdeModulePkg/Application/HelloWorld/HelloWorld.c
@@ -2,7 +2,7 @@
   This sample application bases on HelloWorld PCD setting 
   to print "UEFI Hello World!" to the UEFI Console.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
   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        
@@ -18,6 +18,10 @@
 #include <Library/UefiLib.h>
 #include <Library/UefiApplicationEntryPoint.h>
 
+//
+// String token ID of help imformation text.
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN 
(STR_HELLO_WORLD_HELP_INFORMATION);
 
 /**
   The user Entry Point for Application. The user code starts with this function
diff --git a/MdeModulePkg/Application/HelloWorld/HelloWorld.inf 
b/MdeModulePkg/Application/HelloWorld/HelloWorld.inf
index 6514ef3..2240e17 100644
--- a/MdeModulePkg/Application/HelloWorld/HelloWorld.inf
+++ b/MdeModulePkg/Application/HelloWorld/HelloWorld.inf
@@ -6,7 +6,7 @@
 #
 #  It demos how to use EDKII PCD mechanism to make code more flexible.
 #
-#  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -28,6 +28,11 @@
   ENTRY_POINT                    = UefiMain
 
 #
+#  This flag specifies whether HII resource section is generated into PE image.
+#
+  UEFI_HII_RESOURCE_SECTION      = TRUE
+
+#
 # The following information is for reference only and not required by the 
build tools.
 #
 #  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
@@ -35,6 +40,7 @@
 
 [Sources]
   HelloWorld.c
+  HelloWorldStr.uni
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/MdeModulePkg/Application/HelloWorld/HelloWorldStr.uni 
b/MdeModulePkg/Application/HelloWorld/HelloWorldStr.uni
new file mode 100644
index 0000000..3b8b33a
--- /dev/null
+++ b/MdeModulePkg/Application/HelloWorld/HelloWorldStr.uni
@@ -0,0 +1,27 @@
+// /** @file
+// Sample UEFI Application Reference EDKII Module.
+//
+// This is a sample shell application that will print "UEFI Hello World!" to 
the
+// UEFI Console based on PCD setting.
+//
+// It demos how to use EDKII PCD mechanism to make code more flexible.
+//
+// Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+//
+// 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
+// http://opensource.org/licenses/bsd-license.php
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+//
+// **/
+
+/=#
+
+#langdef en-US "English"
+
+#string STR_HELLO_WORLD_HELP_INFORMATION        #language en-US ""
+".TH HelloWorld 0 "Displays a \"UEFI Hello World!\" string."\r\n"
+".SH NAME\r\n"
+"HelloWorld application.\r\n"
-- 
2.7.1.windows.2

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to