X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FApplication%2FHelloWorld%2FHelloWorld.c;h=e45a3746e7c4b88ccbaa6a5430ffdd57c30662a1;hp=b1d16f76a0b0b9a2de7ec7987c042c5b47606419;hb=HEAD;hpb=223c22d8ea61384a107c6dbc666d6fd33f573cce diff --git a/MdeModulePkg/Application/HelloWorld/HelloWorld.c b/MdeModulePkg/Application/HelloWorld/HelloWorld.c index b1d16f76a0..ab581c040c 100644 --- a/MdeModulePkg/Application/HelloWorld/HelloWorld.c +++ b/MdeModulePkg/Application/HelloWorld/HelloWorld.c @@ -1,33 +1,34 @@ /** @file - This simple application just print a "UEFI Hello World!" to the UEFI Console. - - Copyright (c) 2006 - 2007, Intel Corporation - All rights reserved. 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 + This sample application bases on HelloWorld PCD setting + to print "UEFI Hello World!" to the UEFI Console. - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include #include -#include #include #include -#include +// +// String token ID of help message text. +// Shell supports to find help message in the resource section of an application image if +// .MAN file is not found. This global variable is added to make build tool recognizes +// that the help string is consumed by user and then build tool will add the string into +// the resource section. Thus the application can use '-?' option to show help message in +// Shell. +// +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 - as the real entry point for the image goes into a library that calls this - function. + as the real entry point for the application. - @param[in] ImageHandle The firmware allocated handle for the EFI image. + @param[in] ImageHandle The firmware allocated handle for the EFI image. @param[in] SystemTable A pointer to the EFI System Table. - + @retval EFI_SUCCESS The entry point is executed successfully. @retval other Some error occurs when executing this entry point. @@ -39,16 +40,19 @@ UefiMain ( IN EFI_SYSTEM_TABLE *SystemTable ) { - UINT32 Index; - - Index = 0; - + UINT32 Index; + + Index = 0; + // // Three PCD type (FeatureFlag, UINT32 and String) are used as the sample. // if (FeaturePcdGet (PcdHelloWorldPrintEnable)) { - for (Index = 0; Index < PcdGet32 (PcdHelloWorldPrintTimes); Index ++) { - Print ((CHAR16*)PcdGetPtr (PcdHelloWorldPrintString)); + for (Index = 0; Index < PcdGet32 (PcdHelloWorldPrintTimes); Index++) { + // + // Use UefiLib Print API to print string to UEFI console + // + Print ((CHAR16 *)PcdGetPtr (PcdHelloWorldPrintString)); } }