2 Mde UEFI library API implementation.
3 Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE
5 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "UefiLibInternal.h"
12 GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors
[16] = {
13 { 0x00, 0x00, 0x00, 0x00 },
14 { 0x98, 0x00, 0x00, 0x00 },
15 { 0x00, 0x98, 0x00, 0x00 },
16 { 0x98, 0x98, 0x00, 0x00 },
17 { 0x00, 0x00, 0x98, 0x00 },
18 { 0x98, 0x00, 0x98, 0x00 },
19 { 0x00, 0x98, 0x98, 0x00 },
20 { 0x98, 0x98, 0x98, 0x00 },
21 { 0x10, 0x10, 0x10, 0x00 },
22 { 0xff, 0x10, 0x10, 0x00 },
23 { 0x10, 0xff, 0x10, 0x00 },
24 { 0xff, 0xff, 0x10, 0x00 },
25 { 0x10, 0x10, 0xff, 0x00 },
26 { 0xf0, 0x10, 0xff, 0x00 },
27 { 0x10, 0xff, 0xff, 0x00 },
28 { 0xff, 0xff, 0xff, 0x00 }
32 Internal function which prints a formatted Unicode string to the console output device
35 This function prints a formatted Unicode string to the console output device
36 specified by Console and returns the number of Unicode characters that printed
37 to it. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize,
38 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
39 If Format is NULL, then ASSERT().
40 If Format is not aligned on a 16-bit boundary, then ASSERT().
42 @param Format A Null-terminated Unicode format string.
43 @param Console The output console.
44 @param Marker A VA_LIST marker for the variable argument list.
46 @return The number of Unicode characters in the produced
47 output buffer, not including the Null-terminator.
51 IN CONST CHAR16
*Format
,
52 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Console
,
61 ASSERT (Format
!= NULL
);
62 ASSERT (((UINTN
)Format
& BIT0
) == 0);
63 ASSERT (Console
!= NULL
);
65 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
67 Buffer
= (CHAR16
*)AllocatePool (BufferSize
);
68 ASSERT (Buffer
!= NULL
);
70 Return
= UnicodeVSPrint (Buffer
, BufferSize
, Format
, Marker
);
72 if ((Console
!= NULL
) && (Return
> 0)) {
74 // To be extra safe make sure Console has been initialized
76 Status
= Console
->OutputString (Console
, Buffer
);
77 if (EFI_ERROR (Status
)) {
88 Prints a formatted Unicode string to the console output device specified by
89 ConOut defined in the EFI_SYSTEM_TABLE.
91 This function prints a formatted Unicode string to the console output device
92 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
93 characters that printed to ConOut. If the length of the formatted Unicode
94 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
95 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
96 If Format is NULL, then ASSERT().
97 If Format is not aligned on a 16-bit boundary, then ASSERT().
98 If gST->ConOut is NULL, then ASSERT().
100 @param Format A Null-terminated Unicode format string.
101 @param ... A Variable argument list whose contents are accessed based
102 on the format string specified by Format.
104 @return The number of Unicode characters printed to ConOut.
110 IN CONST CHAR16
*Format
,
117 VA_START (Marker
, Format
);
119 Return
= InternalPrint (Format
, gST
->ConOut
, Marker
);
127 Prints a formatted Unicode string to the console output device specified by
128 StdErr defined in the EFI_SYSTEM_TABLE.
130 This function prints a formatted Unicode string to the console output device
131 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
132 characters that printed to StdErr. If the length of the formatted Unicode
133 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
134 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
135 If Format is NULL, then ASSERT().
136 If Format is not aligned on a 16-bit boundary, then ASSERT().
137 If gST->StdErr is NULL, then ASSERT().
139 @param Format A Null-terminated Unicode format string.
140 @param ... Variable argument list whose contents are accessed based
141 on the format string specified by Format.
143 @return The number of Unicode characters printed to StdErr.
149 IN CONST CHAR16
*Format
,
156 VA_START (Marker
, Format
);
158 Return
= InternalPrint (Format
, gST
->StdErr
, Marker
);
166 Internal function which prints a formatted ASCII string to the console output device
169 This function prints a formatted ASCII string to the console output device
170 specified by Console and returns the number of ASCII characters that printed
171 to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
172 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
174 If Format is NULL, then ASSERT().
176 @param Format A Null-terminated ASCII format string.
177 @param Console The output console.
178 @param Marker VA_LIST marker for the variable argument list.
180 @return The number of Unicode characters in the produced
181 output buffer not including the Null-terminator.
186 IN CONST CHAR8
*Format
,
187 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Console
,
196 ASSERT (Format
!= NULL
);
197 ASSERT (Console
!= NULL
);
199 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
201 Buffer
= (CHAR16
*)AllocatePool (BufferSize
);
202 ASSERT (Buffer
!= NULL
);
204 Return
= UnicodeVSPrintAsciiFormat (Buffer
, BufferSize
, Format
, Marker
);
206 if (Console
!= NULL
) {
208 // To be extra safe make sure Console has been initialized
210 Status
= Console
->OutputString (Console
, Buffer
);
211 if (EFI_ERROR (Status
)) {
222 Prints a formatted ASCII string to the console output device specified by
223 ConOut defined in the EFI_SYSTEM_TABLE.
225 This function prints a formatted ASCII string to the console output device
226 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
227 characters that printed to ConOut. If the length of the formatted ASCII
228 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
229 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
230 If Format is NULL, then ASSERT().
231 If gST->ConOut is NULL, then ASSERT().
233 @param Format A Null-terminated ASCII format string.
234 @param ... Variable argument list whose contents are accessed based
235 on the format string specified by Format.
237 @return The number of ASCII characters printed to ConOut.
243 IN CONST CHAR8
*Format
,
250 ASSERT (Format
!= NULL
);
252 VA_START (Marker
, Format
);
254 Return
= AsciiInternalPrint (Format
, gST
->ConOut
, Marker
);
262 Prints a formatted ASCII string to the console output device specified by
263 StdErr defined in the EFI_SYSTEM_TABLE.
265 This function prints a formatted ASCII string to the console output device
266 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
267 characters that printed to StdErr. If the length of the formatted ASCII
268 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
269 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
270 If Format is NULL, then ASSERT().
271 If gST->StdErr is NULL, then ASSERT().
273 @param Format A Null-terminated ASCII format string.
274 @param ... Variable argument list whose contents are accessed based
275 on the format string specified by Format.
277 @return The number of ASCII characters printed to ConErr.
283 IN CONST CHAR8
*Format
,
290 ASSERT (Format
!= NULL
);
292 VA_START (Marker
, Format
);
294 Return
= AsciiInternalPrint (Format
, gST
->StdErr
, Marker
);
302 Internal function to print a formatted Unicode string to a graphics console device specified by
303 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
305 This function prints a formatted Unicode string to the graphics console device
306 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
307 Unicode characters printed. The EFI_HII_FONT_PROTOCOL is used to convert the
308 string to a bitmap using the glyphs registered with the
309 HII database. No wrapping is performed, so any portions of the string the fall
310 outside the active display region will not be displayed.
312 If a graphics console device is not associated with the ConsoleOutputHandle
313 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
314 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
315 string is printed, and 0 is returned.
317 @param PointX An X coordinate to print the string.
318 @param PointY A Y coordinate to print the string.
319 @param Foreground The foreground color of the string being printed. This is
320 an optional parameter that may be NULL. If it is NULL,
321 then the foreground color of the current ConOut device
322 in the EFI_SYSTEM_TABLE is used.
323 @param Background The background color of the string being printed. This is
324 an optional parameter that may be NULL. If it is NULL,
325 then the background color of the current ConOut device
326 in the EFI_SYSTEM_TABLE is used.
327 @param Buffer A Null-terminated Unicode formatted string.
328 @param PrintNum The number of Unicode formatted string to be printed.
330 @return The number of Unicode Characters printed. Zero means no any character
331 displayed successfully.
335 InternalPrintGraphic (
338 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Foreground
,
339 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Background
,
345 UINT32 HorizontalResolution
;
346 UINT32 VerticalResolution
;
349 EFI_HII_FONT_PROTOCOL
*HiiFont
;
350 EFI_IMAGE_OUTPUT
*Blt
;
351 EFI_FONT_DISPLAY_INFO FontInfo
;
352 EFI_HII_ROW_INFO
*RowInfoArray
;
353 UINTN RowInfoArraySize
;
354 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
355 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
356 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Sto
;
357 EFI_HANDLE ConsoleHandle
;
362 HorizontalResolution
= 0;
363 VerticalResolution
= 0;
367 ConsoleHandle
= gST
->ConsoleOutHandle
;
369 ASSERT (ConsoleHandle
!= NULL
);
371 Status
= gBS
->HandleProtocol (
373 &gEfiGraphicsOutputProtocolGuid
,
374 (VOID
**)&GraphicsOutput
378 if (EFI_ERROR (Status
) && FeaturePcdGet (PcdUgaConsumeSupport
)) {
380 // If no GOP available, try to open UGA Draw protocol if supported.
382 GraphicsOutput
= NULL
;
384 Status
= gBS
->HandleProtocol (
386 &gEfiUgaDrawProtocolGuid
,
391 if (EFI_ERROR (Status
)) {
395 Status
= gBS
->HandleProtocol (
397 &gEfiSimpleTextOutProtocolGuid
,
401 if (EFI_ERROR (Status
)) {
405 if (GraphicsOutput
!= NULL
) {
406 HorizontalResolution
= GraphicsOutput
->Mode
->Info
->HorizontalResolution
;
407 VerticalResolution
= GraphicsOutput
->Mode
->Info
->VerticalResolution
;
408 } else if ((UgaDraw
!= NULL
) && FeaturePcdGet (PcdUgaConsumeSupport
)) {
409 UgaDraw
->GetMode (UgaDraw
, &HorizontalResolution
, &VerticalResolution
, &ColorDepth
, &RefreshRate
);
414 ASSERT ((HorizontalResolution
!= 0) && (VerticalResolution
!= 0));
416 Status
= gBS
->LocateProtocol (&gEfiHiiFontProtocolGuid
, NULL
, (VOID
**)&HiiFont
);
417 if (EFI_ERROR (Status
)) {
421 Blt
= (EFI_IMAGE_OUTPUT
*)AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT
));
422 ASSERT (Blt
!= NULL
);
424 Blt
->Width
= (UINT16
)(HorizontalResolution
);
425 Blt
->Height
= (UINT16
)(VerticalResolution
);
427 ZeroMem (&FontInfo
, sizeof (EFI_FONT_DISPLAY_INFO
));
429 if (Foreground
!= NULL
) {
430 CopyMem (&FontInfo
.ForegroundColor
, Foreground
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
433 &FontInfo
.ForegroundColor
,
434 &mEfiColors
[Sto
->Mode
->Attribute
& 0x0f],
435 sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
439 if (Background
!= NULL
) {
440 CopyMem (&FontInfo
.BackgroundColor
, Background
, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
443 &FontInfo
.BackgroundColor
,
444 &mEfiColors
[Sto
->Mode
->Attribute
>> 4],
445 sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
)
449 if (GraphicsOutput
!= NULL
) {
450 Blt
->Image
.Screen
= GraphicsOutput
;
452 Status
= HiiFont
->StringToImage (
454 EFI_HII_IGNORE_IF_NO_GLYPH
| EFI_HII_OUT_FLAG_CLIP
|
455 EFI_HII_OUT_FLAG_CLIP_CLEAN_X
| EFI_HII_OUT_FLAG_CLIP_CLEAN_Y
|
456 EFI_HII_IGNORE_LINE_BREAK
| EFI_HII_DIRECT_TO_SCREEN
,
466 if (EFI_ERROR (Status
)) {
469 } else if (FeaturePcdGet (PcdUgaConsumeSupport
)) {
470 ASSERT (UgaDraw
!= NULL
);
473 // Ensure Width * Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow.
475 if (Blt
->Width
> DivU64x32 (MAX_UINTN
, Blt
->Height
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
))) {
479 Blt
->Image
.Bitmap
= AllocateZeroPool ((UINT32
)Blt
->Width
* Blt
->Height
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
));
480 ASSERT (Blt
->Image
.Bitmap
!= NULL
);
483 // StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform,
484 // we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
486 Status
= HiiFont
->StringToImage (
488 EFI_HII_IGNORE_IF_NO_GLYPH
| EFI_HII_OUT_FLAG_CLIP
|
489 EFI_HII_OUT_FLAG_CLIP_CLEAN_X
| EFI_HII_OUT_FLAG_CLIP_CLEAN_Y
|
490 EFI_HII_IGNORE_LINE_BREAK
,
501 if (!EFI_ERROR (Status
)) {
502 ASSERT (RowInfoArray
!= NULL
);
504 // Explicit Line break characters are ignored, so the updated parameter RowInfoArraySize by StringToImage will
505 // always be 1 or 0 (if there is no valid Unicode Char can be printed). ASSERT here to make sure.
507 ASSERT (RowInfoArraySize
<= 1);
509 if (RowInfoArraySize
!= 0) {
510 Width
= RowInfoArray
[0].LineWidth
;
511 Height
= RowInfoArray
[0].LineHeight
;
512 Delta
= Blt
->Width
* sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL
);
519 Status
= UgaDraw
->Blt (
521 (EFI_UGA_PIXEL
*)Blt
->Image
.Bitmap
,
522 EfiUgaBltBufferToVideo
,
535 FreePool (Blt
->Image
.Bitmap
);
541 // Calculate the number of actual printed characters
543 if (RowInfoArraySize
!= 0) {
544 PrintNum
= RowInfoArray
[0].EndIndex
- RowInfoArray
[0].StartIndex
+ 1;
549 FreePool (RowInfoArray
);
562 Prints a formatted Unicode string to a graphics console device specified by
563 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
565 This function prints a formatted Unicode string to the graphics console device
566 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
567 Unicode characters displayed, not including partial characters that may be clipped
568 by the right edge of the display. If the length of the formatted Unicode string is
569 greater than PcdUefiLibMaxPrintBufferSize, then at most the first
570 PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL
571 StringToImage() service is used to convert the string to a bitmap using the glyphs
572 registered with the HII database. No wrapping is performed, so any portions of the
573 string the fall outside the active display region will not be displayed. Please see
574 Section 27.2.6 of the UEFI Specification for a description of the supported string
575 format including the set of control codes supported by the StringToImage() service.
577 If a graphics console device is not associated with the ConsoleOutputHandle
578 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
579 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
580 string is printed, and 0 is returned.
581 If Format is NULL, then ASSERT().
582 If Format is not aligned on a 16-bit boundary, then ASSERT().
583 If gST->ConsoleOutputHandle is NULL, then ASSERT().
585 @param PointX An X coordinate to print the string.
586 @param PointY A Y coordinate to print the string.
587 @param ForeGround The foreground color of the string being printed. This is
588 an optional parameter that may be NULL. If it is NULL,
589 then the foreground color of the current ConOut device
590 in the EFI_SYSTEM_TABLE is used.
591 @param BackGround The background color of the string being printed. This is
592 an optional parameter that may be NULL. If it is NULL,
593 then the background color of the current ConOut device
594 in the EFI_SYSTEM_TABLE is used.
595 @param Format A Null-terminated Unicode format string. See Print Library
596 for the supported format string syntax.
597 @param ... A Variable argument list whose contents are accessed based on
598 the format string specified by Format.
600 @return The number of Unicode characters printed.
608 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*ForeGround OPTIONAL
,
609 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BackGround OPTIONAL
,
610 IN CONST CHAR16
*Format
,
620 ASSERT (Format
!= NULL
);
621 ASSERT (((UINTN
)Format
& BIT0
) == 0);
623 VA_START (Marker
, Format
);
625 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
627 Buffer
= (CHAR16
*)AllocatePool (BufferSize
);
628 ASSERT (Buffer
!= NULL
);
630 PrintNum
= UnicodeVSPrint (Buffer
, BufferSize
, Format
, Marker
);
634 ReturnNum
= InternalPrintGraphic (PointX
, PointY
, ForeGround
, BackGround
, Buffer
, PrintNum
);
642 Prints a formatted ASCII string to a graphics console device specified by
643 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
645 This function prints a formatted ASCII string to the graphics console device
646 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
647 ASCII characters displayed, not including partial characters that may be clipped
648 by the right edge of the display. If the length of the formatted ASCII string is
649 greater than PcdUefiLibMaxPrintBufferSize, then at most the first
650 PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL
651 StringToImage() service is used to convert the string to a bitmap using the glyphs
652 registered with the HII database. No wrapping is performed, so any portions of the
653 string the fall outside the active display region will not be displayed. Please see
654 Section 27.2.6 of the UEFI Specification for a description of the supported string
655 format including the set of control codes supported by the StringToImage() service.
657 If a graphics console device is not associated with the ConsoleOutputHandle
658 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
659 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
660 string is printed, and 0 is returned.
661 If Format is NULL, then ASSERT().
662 If gST->ConsoleOutputHandle is NULL, then ASSERT().
664 @param PointX An X coordinate to print the string.
665 @param PointY A Y coordinate to print the string.
666 @param ForeGround The foreground color of the string being printed. This is
667 an optional parameter that may be NULL. If it is NULL,
668 then the foreground color of the current ConOut device
669 in the EFI_SYSTEM_TABLE is used.
670 @param BackGround The background color of the string being printed. This is
671 an optional parameter that may be NULL. If it is NULL,
672 then the background color of the current ConOut device
673 in the EFI_SYSTEM_TABLE is used.
674 @param Format A Null-terminated ASCII format string. See Print Library
675 for the supported format string syntax.
676 @param ... Variable argument list whose contents are accessed based on
677 the format string specified by Format.
679 @return The number of ASCII characters printed.
687 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*ForeGround OPTIONAL
,
688 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*BackGround OPTIONAL
,
689 IN CONST CHAR8
*Format
,
699 ASSERT (Format
!= NULL
);
701 VA_START (Marker
, Format
);
703 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
705 Buffer
= (CHAR16
*)AllocatePool (BufferSize
);
706 ASSERT (Buffer
!= NULL
);
708 PrintNum
= UnicodeSPrintAsciiFormat (Buffer
, BufferSize
, Format
, Marker
);
712 ReturnNum
= InternalPrintGraphic (PointX
, PointY
, ForeGround
, BackGround
, Buffer
, PrintNum
);
720 Appends a formatted Unicode string to a Null-terminated Unicode string
722 This function appends a formatted Unicode string to the Null-terminated
723 Unicode string specified by String. String is optional and may be NULL.
724 Storage for the formatted Unicode string returned is allocated using
725 AllocatePool(). The pointer to the appended string is returned. The caller
726 is responsible for freeing the returned string.
728 If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().
729 If FormatString is NULL, then ASSERT().
730 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
732 @param[in] String A Null-terminated Unicode string.
733 @param[in] FormatString A Null-terminated Unicode format string.
734 @param[in] Marker VA_LIST marker for the variable argument list.
736 @retval NULL There was not enough available memory.
737 @return Null-terminated Unicode string is that is the formatted
738 string appended to String.
743 IN CHAR16
*String OPTIONAL
,
744 IN CONST CHAR16
*FormatString
,
748 UINTN CharactersRequired
;
750 CHAR16
*BufferToReturn
;
753 VA_COPY (ExtraMarker
, Marker
);
754 CharactersRequired
= SPrintLength (FormatString
, ExtraMarker
);
755 VA_END (ExtraMarker
);
757 if (String
!= NULL
) {
758 SizeRequired
= StrSize (String
) + (CharactersRequired
* sizeof (CHAR16
));
760 SizeRequired
= sizeof (CHAR16
) + (CharactersRequired
* sizeof (CHAR16
));
763 BufferToReturn
= AllocatePool (SizeRequired
);
765 if (BufferToReturn
== NULL
) {
768 BufferToReturn
[0] = L
'\0';
771 if (String
!= NULL
) {
772 StrCpyS (BufferToReturn
, SizeRequired
/ sizeof (CHAR16
), String
);
775 UnicodeVSPrint (BufferToReturn
+ StrLen (BufferToReturn
), (CharactersRequired
+1) * sizeof (CHAR16
), FormatString
, Marker
);
777 ASSERT (StrSize (BufferToReturn
) == SizeRequired
);
779 return (BufferToReturn
);
783 Appends a formatted Unicode string to a Null-terminated Unicode string
785 This function appends a formatted Unicode string to the Null-terminated
786 Unicode string specified by String. String is optional and may be NULL.
787 Storage for the formatted Unicode string returned is allocated using
788 AllocatePool(). The pointer to the appended string is returned. The caller
789 is responsible for freeing the returned string.
791 If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().
792 If FormatString is NULL, then ASSERT().
793 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
795 @param[in] String A Null-terminated Unicode string.
796 @param[in] FormatString A Null-terminated Unicode format string.
797 @param[in] ... The variable argument list whose contents are
798 accessed based on the format string specified by
801 @retval NULL There was not enough available memory.
802 @return Null-terminated Unicode string is that is the formatted
803 string appended to String.
808 IN CHAR16
*String OPTIONAL
,
809 IN CONST CHAR16
*FormatString
,
816 VA_START (Marker
, FormatString
);
817 NewString
= CatVSPrint (String
, FormatString
, Marker
);