/** @file\r
- This driver produces Print2 protocol layered on top of the PrintLib from the MdePkg.\r
+ This driver produces Print2 protocols layered on top of the PrintLib from the MdePkg.\r
\r
-Copyright (c) 2009, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\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
#include <Library/DebugLib.h>\r
#include <Library/UefiDriverEntryPoint.h>\r
\r
+/**\r
+ Implementaion of the UnicodeValueToString service in EFI_PRINT2_PROTOCOL.\r
+\r
+ If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then ASSERT().\r
+\r
+ @param Buffer The pointer to the output buffer for the produced\r
+ Null-terminated Unicode string.\r
+ @param Flags The bitmask of flags that specify left justification, zero\r
+ pad, and commas.\r
+ @param Value The 64-bit signed value to convert to a string.\r
+ @param Width The maximum number of Unicode characters to place in Buffer,\r
+ not including the Null-terminator.\r
+\r
+ @return If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, return 0.\r
+ Otherwise, return the number of Unicode characters in Buffer not\r
+ including the Null-terminator.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+PrintDxeUnicodeValueToString (\r
+ IN OUT CHAR16 *Buffer,\r
+ IN UINTN Flags,\r
+ IN INT64 Value,\r
+ IN UINTN Width\r
+ )\r
+{\r
+#ifdef DISABLE_NEW_DEPRECATED_INTERFACES\r
+ //\r
+ // If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then the\r
+ // PrintLib API UnicodeValueToString is already deprecated.\r
+ // In this case, ASSERT will be triggered and zero will be returned for the\r
+ // implementation of the UnicodeValueToString service in EFI_PRINT2_PROTOCOL\r
+ // to indicate that the service is no longer supported.\r
+ //\r
+ DEBUG ((DEBUG_ERROR, "PrintDxe: The UnicodeValueToString service in EFI_PRINT2_PROTOCOL is no longer supported for security reason.\n"));\r
+ DEBUG ((DEBUG_ERROR, "PrintDxe: Please consider using the UnicodeValueToStringS service in EFI_PRINT2S_PROTOCOL.\n"));\r
+ ASSERT (FALSE);\r
+ return 0;\r
+#else\r
+ return UnicodeValueToString (Buffer, Flags, Value, Width);\r
+#endif\r
+}\r
+\r
+/**\r
+ Implementaion of the AsciiValueToString service in EFI_PRINT2_PROTOCOL.\r
+\r
+ If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then ASSERT().\r
+\r
+ @param Buffer A pointer to the output buffer for the produced\r
+ Null-terminated ASCII string.\r
+ @param Flags The bitmask of flags that specify left justification, zero\r
+ pad, and commas.\r
+ @param Value The 64-bit signed value to convert to a string.\r
+ @param Width The maximum number of ASCII characters to place in Buffer,\r
+ not including the Null-terminator.\r
+\r
+ @return If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, return 0.\r
+ Otherwise, return the number of ASCII characters in Buffer not\r
+ including the Null-terminator.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+PrintDxeAsciiValueToString (\r
+ OUT CHAR8 *Buffer,\r
+ IN UINTN Flags,\r
+ IN INT64 Value,\r
+ IN UINTN Width\r
+ )\r
+{\r
+#ifdef DISABLE_NEW_DEPRECATED_INTERFACES\r
+ //\r
+ // If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then the\r
+ // PrintLib API AsciiValueToString is already deprecated.\r
+ // In this case, ASSERT will be triggered and zero will be returned for the\r
+ // implementation of the AsciiValueToString service in EFI_PRINT2_PROTOCOL\r
+ // to indicate that the service is no longer supported.\r
+ //\r
+ DEBUG ((DEBUG_ERROR, "PrintDxe: The AsciiValueToString service in EFI_PRINT2_PROTOCOL is no longer supported for security reason.\n"));\r
+ DEBUG ((DEBUG_ERROR, "PrintDxe: Please consider using the AsciiValueToStringS service in EFI_PRINT2S_PROTOCOL.\n"));\r
+ ASSERT (FALSE);\r
+ return 0;\r
+#else\r
+ return AsciiValueToString (Buffer, Flags, Value, Width);\r
+#endif\r
+}\r
+\r
EFI_HANDLE mPrintThunkHandle = NULL;\r
\r
CONST EFI_PRINT2_PROTOCOL mPrint2Protocol = {\r
- UnicodeVSPrint,\r
+ UnicodeBSPrint,\r
UnicodeSPrint,\r
- UnicodeVSPrintAsciiFormat,\r
+ UnicodeBSPrintAsciiFormat,\r
UnicodeSPrintAsciiFormat,\r
- UnicodeValueToString,\r
- AsciiVSPrint,\r
+ PrintDxeUnicodeValueToString,\r
+ AsciiBSPrint,\r
AsciiSPrint,\r
- AsciiVSPrintUnicodeFormat,\r
+ AsciiBSPrintUnicodeFormat,\r
AsciiSPrintUnicodeFormat,\r
- AsciiValueToString\r
+ PrintDxeAsciiValueToString\r
};\r
\r
+CONST EFI_PRINT2S_PROTOCOL mPrint2SProtocol = {\r
+ UnicodeBSPrint,\r
+ UnicodeSPrint,\r
+ UnicodeBSPrintAsciiFormat,\r
+ UnicodeSPrintAsciiFormat,\r
+ UnicodeValueToStringS,\r
+ AsciiBSPrint,\r
+ AsciiSPrint,\r
+ AsciiBSPrintUnicodeFormat,\r
+ AsciiSPrintUnicodeFormat,\r
+ AsciiValueToStringS\r
+};\r
\r
/**\r
The user Entry Point for Print module.\r
Status = gBS->InstallMultipleProtocolInterfaces (\r
&mPrintThunkHandle,\r
&gEfiPrint2ProtocolGuid, &mPrint2Protocol,\r
+ &gEfiPrint2SProtocolGuid, &mPrint2SProtocol,\r
NULL\r
);\r
ASSERT_EFI_ERROR (Status);\r