public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] EmulatorPkg/Win: Change SecPrint to use PrintLib
@ 2019-06-14  8:18 Ni, Ray
  0 siblings, 0 replies; only message in thread
From: Ni, Ray @ 2019-06-14  8:18 UTC (permalink / raw)
  To: devel; +Cc: Jordan Justen, Andrew Fish, Zhiguang Liu, Hao A Wu

The change is to enhance SecPrint to support printing
EFI_STATUS.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
---
 EmulatorPkg/Win/Host/WinHost.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c
index dd52075f98..bd7662683a 100644
--- a/EmulatorPkg/Win/Host/WinHost.c
+++ b/EmulatorPkg/Win/Host/WinHost.c
@@ -8,7 +8,7 @@
   This code produces 128 K of temporary memory for the SEC stack by directly
   allocate memory space with ReadWrite and Execute attribute.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
@@ -167,15 +167,13 @@ SecPrint (
   ...
   )
 {
-  va_list  Marker;
+  VA_LIST  Marker;
   UINTN    CharCount;
   CHAR8    Buffer[0x1000];
 
-  va_start (Marker, Format);
-
-  _vsnprintf (Buffer, sizeof (Buffer), Format, Marker);
-
-  va_end (Marker);
+  VA_START (Marker, Format);
+  AsciiVSPrint (Buffer, sizeof Buffer, Format, Marker);
+  VA_END (Marker);
 
   CharCount = strlen (Buffer);
   WriteFile (
@@ -431,7 +429,7 @@ Returns:
   gSystemMemoryCount  = CountSeparatorsInString (MemorySizeStr, '!') + 1;
   gSystemMemory       = calloc (gSystemMemoryCount, sizeof (NT_SYSTEM_MEMORY));
   if (gSystemMemory == NULL) {
-    SecPrint ("ERROR : Can not allocate memory for %S.  Exiting.\n", MemorySizeStr);
+    SecPrint ("ERROR : Can not allocate memory for %s.  Exiting.\n", MemorySizeStr);
     exit (1);
   }
 
@@ -441,7 +439,7 @@ Returns:
   gFdInfoCount  = CountSeparatorsInString (FirmwareVolumesStr, '!') + 1;
   gFdInfo       = calloc (gFdInfoCount, sizeof (NT_FD_INFO));
   if (gFdInfo == NULL) {
-    SecPrint ("ERROR : Can not allocate memory for %S.  Exiting.\n", FirmwareVolumesStr);
+    SecPrint ("ERROR : Can not allocate memory for %s.  Exiting.\n", FirmwareVolumesStr);
     exit (1);
   }
   //
@@ -521,11 +519,11 @@ Returns:
               &gFdInfo[Index].Size
               );
     if (EFI_ERROR (Status)) {
-      SecPrint ("ERROR : Can not open Firmware Device File %S (0x%X).  Exiting.\n", FileName, Status);
+      SecPrint ("ERROR : Can not open Firmware Device File %s (%r).  Exiting.\n", FileName, Status);
       exit (1);
     }
 
-    SecPrint ("  FD loaded from %S\n", FileName);
+    SecPrint ("  FD loaded from %s\n", FileName);
 
     if (SecFile == NULL) {
       //
@@ -914,9 +912,9 @@ PeCoffLoaderRelocateImageExtraAction (
 
     if ((Library != NULL) && (DllEntryPoint != NULL)) {
       ImageContext->EntryPoint  = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint;
-      SecPrint ("LoadLibraryEx (%S,\n               NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName);
+      SecPrint ("LoadLibraryEx (%s,\n               NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName);
     } else {
-      SecPrint ("WARNING: No source level debug %S. \n", DllFileName);
+      SecPrint ("WARNING: No source level debug %s. \n", DllFileName);
     }
 
     free (DllFileName);
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-14  8:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-14  8:18 [PATCH] EmulatorPkg/Win: Change SecPrint to use PrintLib Ni, Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox