[edk2-devel] [PATCH] EmulatorPkg/Win: Change SecPrint to use PrintLib

Ni, Ray posted 1 patch 4 years, 10 months ago
Failed in applying to current master (apply log)
EmulatorPkg/Win/Host/WinHost.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
[edk2-devel] [PATCH] EmulatorPkg/Win: Change SecPrint to use PrintLib
Posted by Ni, Ray 4 years, 10 months ago
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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#42421): https://edk2.groups.io/g/devel/message/42421
Mute This Topic: https://groups.io/mt/32061754/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-