]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/PrintLib.h
dfbcd1b340be8e2d35fc0abc7cc2d1c65f98aa60
2 Provides services to print a formatted string to a buffer. All combinations of
3 Unicode and ASCII strings are supported.
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
8 The Print Library functions provide a simple means to produce formatted output
9 strings. Many of the output functions use a format string to describe how to
10 format the output of variable arguments. The format string consists of normal
11 text and argument descriptors. There are no restrictions for how the normal
12 text and argument descriptors can be mixed. The following end of line(EOL)
13 translations must be performed on the contents of the format string:
15 - '\\r' is translated to '\\r'
16 - '\\r\\n' is translated to '\\r\\n'
17 - '\\n' is translated to '\\r\\n'
18 - '\\n\\r' is translated to '\\r\\n'
20 This does not follow the ANSI C standard for sprint(). The format of argument
21 descriptors is described below. The ANSI C standard for sprint() has been
22 followed for some of the format types, and has not been followed for others.
23 The exceptions are noted below.
25 %[flags][width][.precision]type
29 - The field is left justified. If not flag is not specified, then the
30 field is right justified.
32 - Prefix a space character to a number. Only valid for types X, x, and d.
34 - Prefix a plus character to a number. Only valid for types X, x, and d.
35 If both space and + are specified, then space is ignored.
37 - Pad with 0 characters to the left of a number. Only valid for types
40 - Place a comma every 3rd digit of the number. Only valid for type d.
41 If 0 is also specified, then 0 is ignored.
43 - The number being printed is size UINT64. Only valid for types X, x, and d.
44 If this flag is not specified, then the number being printed is size int.
45 - NOTE: All invalid flags are ignored.
50 - The width of the field is specified by a UINTN argument in the
53 - The number specified as a decimal value represents the width of
55 - NOTE: If [width] is not specified, then a field width of 0 is assumed.
60 - The precision of the field is specified by a UINTN argument in the
63 - The number specified as a decimal value represents the precision of
65 - NOTE: If [.precision] is not specified, then a precision of 0 is assumed.
72 - The argument is a Unicode character. ASCII characters can be printed
73 using this type too by making sure bits 8..15 of the argument are set to 0.
75 - The argument is an unsigned hexadecimal number. The characters used are 0..9 and
76 A..F. If the flag 'L' is not specified, then the argument is assumed
77 to be size int. This does not follow ANSI C.
79 - The argument is an unsigned hexadecimal number and the number is padded with
80 zeros. This is equivalent to a format string of "0x". If the flag
81 'L' is not specified, then the argument is assumed to be size int.
82 This does not follow ANSI C.
84 - The argument is a signed decimal number. If the flag 'L' is not specified,
85 then the argument is assumed to be size int.
87 - The argument is a unsigned decimal number. If the flag 'L' is not specified,
88 then the argument is assumed to be size int.
90 - The argument is a pointer that is a (VOID *), and it is printed as an
91 unsigned hexadecimal number The characters used are 0..9 and A..F.
93 - The argument is a pointer to an ASCII string.
94 This does not follow ANSI C.
96 - The argument is a pointer to a Unicode string.
97 This does not follow ANSI C.
99 - The argument is a pointer to a GUID structure. The GUID is printed
100 in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
101 This does not follow ANSI C.
103 - The argument is a pointer to an EFI_TIME structure. The time and
104 date are printed in the format "mm/dd/yyyy hh:mm" where mm is the
105 month zero padded, dd is the day zero padded, yyyy is the year zero
106 padded, hh is the hour zero padded, and mm is minutes zero padded.
107 This does not follow ANSI C.
109 - The argument is a RETURN_STATUS value. This value is converted to
110 a string following the table below. This does not follow ANSI C.
115 - RETURN_INVALID_PARAMETER
116 - "Invalid Parameter"
119 - RETURN_BAD_BUFFER_SIZE
121 - RETURN_BUFFER_TOO_SMALL
125 - RETURN_DEVICE_ERROR
127 - RETURN_WRITE_PROTECTED
129 - RETURN_OUT_OF_RESOURCES
131 - RETURN_VOLUME_CORRUPTED
137 - RETURN_MEDIA_CHANGED
141 - RETURN_ACCESS_DENIED
151 - RETURN_ALREADY_STARTED
159 - RETURN_PROTOCOL_ERROR
161 - RETURN_WARN_UNKNOWN_GLYPH
162 - "Warning Unknown Glyph"
163 - RETURN_WARN_DELETE_FAILURE
164 - "Warning Delete Failure"
165 - RETURN_WARN_WRITE_FAILURE
166 - "Warning Write Failure"
167 - RETURN_WARN_BUFFER_TOO_SMALL
168 - "Warning Buffer Too Small"
172 #ifndef __PRINT_LIB_H__
173 #define __PRINT_LIB_H__
176 /// Define the maximum number of characters that are required to
177 /// encode with a NULL terminator a decimal, hexadecimal, GUID,
180 /// Maximum Length Decimal String = 28
181 /// "-9,223,372,036,854,775,808"
182 /// Maximum Length Hexadecimal String = 17
183 /// "FFFFFFFFFFFFFFFF"
184 /// Maximum Length GUID = 37
185 /// "00000000-0000-0000-0000-000000000000"
186 /// Maximum Length TIME = 18
187 /// "12/12/2006 12:12"
189 #define MAXIMUM_VALUE_CHARACTERS 38
192 /// Flags bitmask values use in UnicodeValueToString() and
193 /// AsciiValueToString()
195 #define LEFT_JUSTIFY 0x01
196 #define COMMA_TYPE 0x08
197 #define PREFIX_ZERO 0x20
198 #define RADIX_HEX 0x80
201 Produces a Null-terminated Unicode string in an output buffer based on
202 a Null-terminated Unicode format string and a VA_LIST argument list.
204 This function is similar as vsnprintf_s defined in C11.
206 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
208 The Unicode string is produced by parsing the format string specified by FormatString.
209 Arguments are pulled from the variable argument list specified by Marker based on the
210 contents of the format string.
211 The number of Unicode characters in the produced output buffer is returned not including
214 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
215 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
217 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
218 unmodified and 0 is returned.
219 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
220 unmodified and 0 is returned.
221 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
222 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
223 buffer is unmodified and 0 is returned.
224 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
225 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
226 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
228 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
230 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
232 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
233 @param FormatString A Null-terminated Unicode format string.
234 @param Marker VA_LIST marker for the variable argument list.
236 @return The number of Unicode characters in the produced output buffer not including the
243 OUT CHAR16
*StartOfBuffer
,
245 IN CONST CHAR16
*FormatString
,
250 Produces a Null-terminated Unicode string in an output buffer based on
251 a Null-terminated Unicode format string and a BASE_LIST argument list.
253 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
255 The Unicode string is produced by parsing the format string specified by FormatString.
256 Arguments are pulled from the variable argument list specified by Marker based on the
257 contents of the format string.
258 The number of Unicode characters in the produced output buffer is returned not including
261 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
262 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
264 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
265 unmodified and 0 is returned.
266 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
267 unmodified and 0 is returned.
268 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
269 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
270 buffer is unmodified and 0 is returned.
271 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
272 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
273 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
275 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
277 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
279 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
280 @param FormatString A Null-terminated Unicode format string.
281 @param Marker BASE_LIST marker for the variable argument list.
283 @return The number of Unicode characters in the produced output buffer not including the
290 OUT CHAR16
*StartOfBuffer
,
292 IN CONST CHAR16
*FormatString
,
297 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
298 Unicode format string and variable argument list.
300 This function is similar as snprintf_s defined in C11.
302 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
304 The Unicode string is produced by parsing the format string specified by FormatString.
305 Arguments are pulled from the variable argument list based on the contents of the format string.
306 The number of Unicode characters in the produced output buffer is returned not including
309 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
310 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
312 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
313 unmodified and 0 is returned.
314 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
315 unmodified and 0 is returned.
316 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
317 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
318 buffer is unmodified and 0 is returned.
319 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
320 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
321 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
323 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
325 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
327 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
328 @param FormatString A Null-terminated Unicode format string.
329 @param ... Variable argument list whose contents are accessed based on the
330 format string specified by FormatString.
332 @return The number of Unicode characters in the produced output buffer not including the
339 OUT CHAR16
*StartOfBuffer
,
341 IN CONST CHAR16
*FormatString
,
346 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
347 ASCII format string and a VA_LIST argument list.
349 This function is similar as vsnprintf_s defined in C11.
351 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
353 The Unicode string is produced by parsing the format string specified by FormatString.
354 Arguments are pulled from the variable argument list specified by Marker based on the
355 contents of the format string.
356 The number of Unicode characters in the produced output buffer is returned not including
359 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
361 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
362 unmodified and 0 is returned.
363 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
364 unmodified and 0 is returned.
365 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
366 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
367 buffer is unmodified and 0 is returned.
368 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
369 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
370 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
372 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
374 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
376 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
377 @param FormatString A Null-terminated ASCII format string.
378 @param Marker VA_LIST marker for the variable argument list.
380 @return The number of Unicode characters in the produced output buffer not including the
386 UnicodeVSPrintAsciiFormat (
387 OUT CHAR16
*StartOfBuffer
,
389 IN CONST CHAR8
*FormatString
,
394 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
395 ASCII format string and a BASE_LIST argument list.
397 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
399 The Unicode string is produced by parsing the format string specified by FormatString.
400 Arguments are pulled from the variable argument list specified by Marker based on the
401 contents of the format string.
402 The number of Unicode characters in the produced output buffer is returned not including
405 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
407 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
408 unmodified and 0 is returned.
409 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
410 unmodified and 0 is returned.
411 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
412 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
413 buffer is unmodified and 0 is returned.
414 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
415 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
416 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
418 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
420 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
422 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
423 @param FormatString A Null-terminated ASCII format string.
424 @param Marker BASE_LIST marker for the variable argument list.
426 @return The number of Unicode characters in the produced output buffer not including the
432 UnicodeBSPrintAsciiFormat (
433 OUT CHAR16
*StartOfBuffer
,
435 IN CONST CHAR8
*FormatString
,
440 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
441 ASCII format string and variable argument list.
443 This function is similar as snprintf_s defined in C11.
445 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
447 The Unicode string is produced by parsing the format string specified by FormatString.
448 Arguments are pulled from the variable argument list based on the contents of the
450 The number of Unicode characters in the produced output buffer is returned not including
453 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
455 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
456 unmodified and 0 is returned.
457 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
458 unmodified and 0 is returned.
459 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
460 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
461 buffer is unmodified and 0 is returned.
462 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
463 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
464 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
466 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
468 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
470 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
471 @param FormatString A Null-terminated ASCII format string.
472 @param ... Variable argument list whose contents are accessed based on the
473 format string specified by FormatString.
475 @return The number of Unicode characters in the produced output buffer not including the
481 UnicodeSPrintAsciiFormat (
482 OUT CHAR16
*StartOfBuffer
,
484 IN CONST CHAR8
*FormatString
,
488 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
491 [ATTENTION] This function is deprecated for security reason.
493 Converts a decimal value to a Null-terminated Unicode string.
495 Converts the decimal number specified by Value to a Null-terminated Unicode
496 string specified by Buffer containing at most Width characters. No padding of spaces
497 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
498 The number of Unicode characters in Buffer is returned, not including the Null-terminator.
499 If the conversion contains more than Width characters, then only the first
500 Width characters are returned, and the total number of characters
501 required to perform the conversion is returned.
502 Additional conversion parameters are specified in Flags.
504 The Flags bit LEFT_JUSTIFY is always ignored.
505 All conversions are left justified in Buffer.
506 If Width is 0, PREFIX_ZERO is ignored in Flags.
507 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
508 are inserted every 3rd digit starting from the right.
509 If RADIX_HEX is set in Flags, then the output buffer will be
510 formatted in hexadecimal format.
511 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
512 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
513 then Buffer is padded with '0' characters so the combination of the optional '-'
514 sign character, '0' characters, digit characters for Value, and the Null-terminator
515 add up to Width characters.
516 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
517 If Buffer is NULL, then ASSERT().
518 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
519 If unsupported bits are set in Flags, then ASSERT().
520 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
521 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
523 @param Buffer The pointer to the output buffer for the produced Null-terminated
525 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
526 @param Value The 64-bit signed value to convert to a string.
527 @param Width The maximum number of Unicode characters to place in Buffer, not including
530 @return The number of Unicode characters in Buffer, not including the Null-terminator.
535 UnicodeValueToString (
536 IN OUT CHAR16
*Buffer
,
545 Converts a decimal value to a Null-terminated Unicode string.
547 Converts the decimal number specified by Value to a Null-terminated Unicode
548 string specified by Buffer containing at most Width characters. No padding of
549 spaces is ever performed. If Width is 0 then a width of
550 MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than
551 Width characters, then only the first Width characters are placed in Buffer.
552 Additional conversion parameters are specified in Flags.
554 The Flags bit LEFT_JUSTIFY is always ignored.
555 All conversions are left justified in Buffer.
556 If Width is 0, PREFIX_ZERO is ignored in Flags.
557 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and
558 commas are inserted every 3rd digit starting from the right.
559 If RADIX_HEX is set in Flags, then the output buffer will be formatted in
561 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in
563 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then
564 Buffer is padded with '0' characters so the combination of the optional '-'
565 sign character, '0' characters, digit characters for Value, and the
566 Null-terminator add up to Width characters.
568 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
569 If an error would be returned, then the function will also ASSERT().
571 @param Buffer The pointer to the output buffer for the produced
572 Null-terminated Unicode string.
573 @param BufferSize The size of Buffer in bytes, including the
575 @param Flags The bitmask of flags that specify left justification,
576 zero pad, and commas.
577 @param Value The 64-bit signed value to convert to a string.
578 @param Width The maximum number of Unicode characters to place in
579 Buffer, not including the Null-terminator.
581 @retval RETURN_SUCCESS The decimal value is converted.
582 @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted
584 @retval RETURN_INVALID_PARAMETER If Buffer is NULL.
585 If PcdMaximumUnicodeStringLength is not
586 zero, and BufferSize is greater than
587 (PcdMaximumUnicodeStringLength *
588 sizeof (CHAR16) + 1).
589 If unsupported bits are set in Flags.
590 If both COMMA_TYPE and RADIX_HEX are set in
592 If Width >= MAXIMUM_VALUE_CHARACTERS.
597 UnicodeValueToStringS (
598 IN OUT CHAR16
*Buffer
,
606 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
607 ASCII format string and a VA_LIST argument list.
609 This function is similar as vsnprintf_s defined in C11.
611 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
613 The ASCII string is produced by parsing the format string specified by FormatString.
614 Arguments are pulled from the variable argument list specified by Marker based on
615 the contents of the format string.
616 The number of ASCII characters in the produced output buffer is returned not including
619 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
620 unmodified and 0 is returned.
621 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
622 unmodified and 0 is returned.
623 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
624 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
625 is unmodified and 0 is returned.
626 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
627 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
628 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
630 If BufferSize is 0, then no output buffer is produced and 0 is returned.
632 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
634 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
635 @param FormatString A Null-terminated ASCII format string.
636 @param Marker VA_LIST marker for the variable argument list.
638 @return The number of ASCII characters in the produced output buffer not including the
645 OUT CHAR8
*StartOfBuffer
,
647 IN CONST CHAR8
*FormatString
,
652 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
653 ASCII format string and a BASE_LIST argument list.
655 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
657 The ASCII string is produced by parsing the format string specified by FormatString.
658 Arguments are pulled from the variable argument list specified by Marker based on
659 the contents of the format string.
660 The number of ASCII characters in the produced output buffer is returned not including
663 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
664 unmodified and 0 is returned.
665 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
666 unmodified and 0 is returned.
667 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
668 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
669 is unmodified and 0 is returned.
670 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
671 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
672 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
674 If BufferSize is 0, then no output buffer is produced and 0 is returned.
676 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
678 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
679 @param FormatString A Null-terminated ASCII format string.
680 @param Marker BASE_LIST marker for the variable argument list.
682 @return The number of ASCII characters in the produced output buffer not including the
689 OUT CHAR8
*StartOfBuffer
,
691 IN CONST CHAR8
*FormatString
,
696 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
697 ASCII format string and variable argument list.
699 This function is similar as snprintf_s defined in C11.
701 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
703 The ASCII string is produced by parsing the format string specified by FormatString.
704 Arguments are pulled from the variable argument list based on the contents of the
706 The number of ASCII characters in the produced output buffer is returned not including
709 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
710 unmodified and 0 is returned.
711 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
712 unmodified and 0 is returned.
713 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
714 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
715 is unmodified and 0 is returned.
716 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
717 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
718 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
720 If BufferSize is 0, then no output buffer is produced and 0 is returned.
722 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
724 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
725 @param FormatString A Null-terminated ASCII format string.
726 @param ... Variable argument list whose contents are accessed based on the
727 format string specified by FormatString.
729 @return The number of ASCII characters in the produced output buffer not including the
736 OUT CHAR8
*StartOfBuffer
,
738 IN CONST CHAR8
*FormatString
,
743 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
744 Unicode format string and a VA_LIST argument list.
746 This function is similar as vsnprintf_s defined in C11.
748 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
750 The ASCII string is produced by parsing the format string specified by FormatString.
751 Arguments are pulled from the variable argument list specified by Marker based on
752 the contents of the format string.
753 The number of ASCII characters in the produced output buffer is returned not including
756 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
758 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
759 unmodified and 0 is returned.
760 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
761 unmodified and 0 is returned.
762 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
763 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
764 is unmodified and 0 is returned.
765 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
766 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
767 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
769 If BufferSize is 0, then no output buffer is produced and 0 is returned.
771 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
773 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
774 @param FormatString A Null-terminated Unicode format string.
775 @param Marker VA_LIST marker for the variable argument list.
777 @return The number of ASCII characters in the produced output buffer not including the
783 AsciiVSPrintUnicodeFormat (
784 OUT CHAR8
*StartOfBuffer
,
786 IN CONST CHAR16
*FormatString
,
791 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
792 Unicode format string and a BASE_LIST argument list.
794 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
796 The ASCII string is produced by parsing the format string specified by FormatString.
797 Arguments are pulled from the variable argument list specified by Marker based on
798 the contents of the format string.
799 The number of ASCII characters in the produced output buffer is returned not including
802 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
804 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
805 unmodified and 0 is returned.
806 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
807 unmodified and 0 is returned.
808 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
809 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
810 is unmodified and 0 is returned.
811 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
812 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
813 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
815 If BufferSize is 0, then no output buffer is produced and 0 is returned.
817 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
819 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
820 @param FormatString A Null-terminated Unicode format string.
821 @param Marker BASE_LIST marker for the variable argument list.
823 @return The number of ASCII characters in the produced output buffer not including the
829 AsciiBSPrintUnicodeFormat (
830 OUT CHAR8
*StartOfBuffer
,
832 IN CONST CHAR16
*FormatString
,
837 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
838 Unicode format string and variable argument list.
840 This function is similar as snprintf_s defined in C11.
842 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
844 The ASCII string is produced by parsing the format string specified by FormatString.
845 Arguments are pulled from the variable argument list based on the contents of the
847 The number of ASCII characters in the produced output buffer is returned not including
850 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
852 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
853 unmodified and 0 is returned.
854 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
855 unmodified and 0 is returned.
856 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
857 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
858 is unmodified and 0 is returned.
859 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
860 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
861 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
863 If BufferSize is 0, then no output buffer is produced and 0 is returned.
865 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
867 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
868 @param FormatString A Null-terminated Unicode format string.
869 @param ... Variable argument list whose contents are accessed based on the
870 format string specified by FormatString.
872 @return The number of ASCII characters in the produced output buffer not including the
878 AsciiSPrintUnicodeFormat (
879 OUT CHAR8
*StartOfBuffer
,
881 IN CONST CHAR16
*FormatString
,
885 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
888 [ATTENTION] This function is deprecated for security reason.
890 Converts a decimal value to a Null-terminated ASCII string.
892 Converts the decimal number specified by Value to a Null-terminated ASCII string
893 specified by Buffer containing at most Width characters. No padding of spaces
895 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
896 The number of ASCII characters in Buffer is returned, not including the Null-terminator.
897 If the conversion contains more than Width characters, then only the first Width
898 characters are returned, and the total number of characters required to perform
899 the conversion is returned.
900 Additional conversion parameters are specified in Flags.
901 The Flags bit LEFT_JUSTIFY is always ignored.
902 All conversions are left justified in Buffer.
903 If Width is 0, PREFIX_ZERO is ignored in Flags.
904 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
905 are inserted every 3rd digit starting from the right.
906 If RADIX_HEX is set in Flags, then the output buffer will be
907 formatted in hexadecimal format.
908 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
909 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
910 then Buffer is padded with '0' characters so the combination of the optional '-'
911 sign character, '0' characters, digit characters for Value, and the Null-terminator
912 add up to Width characters.
914 If Buffer is NULL, then ASSERT().
915 If unsupported bits are set in Flags, then ASSERT().
916 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
917 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
919 @param Buffer A pointer to the output buffer for the produced Null-terminated
921 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
922 @param Value The 64-bit signed value to convert to a string.
923 @param Width The maximum number of ASCII characters to place in Buffer, not including
926 @return The number of ASCII characters in Buffer, not including the Null-terminator.
941 Converts a decimal value to a Null-terminated Ascii string.
943 Converts the decimal number specified by Value to a Null-terminated Ascii
944 string specified by Buffer containing at most Width characters. No padding of
945 spaces is ever performed. If Width is 0 then a width of
946 MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than
947 Width characters, then only the first Width characters are placed in Buffer.
948 Additional conversion parameters are specified in Flags.
950 The Flags bit LEFT_JUSTIFY is always ignored.
951 All conversions are left justified in Buffer.
952 If Width is 0, PREFIX_ZERO is ignored in Flags.
953 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and
954 commas are inserted every 3rd digit starting from the right.
955 If RADIX_HEX is set in Flags, then the output buffer will be formatted in
957 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in
959 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then
960 Buffer is padded with '0' characters so the combination of the optional '-'
961 sign character, '0' characters, digit characters for Value, and the
962 Null-terminator add up to Width characters.
964 If an error would be returned, then the function will ASSERT().
966 @param Buffer The pointer to the output buffer for the produced
967 Null-terminated Ascii string.
968 @param BufferSize The size of Buffer in bytes, including the
970 @param Flags The bitmask of flags that specify left justification,
971 zero pad, and commas.
972 @param Value The 64-bit signed value to convert to a string.
973 @param Width The maximum number of Ascii characters to place in
974 Buffer, not including the Null-terminator.
976 @retval RETURN_SUCCESS The decimal value is converted.
977 @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted
979 @retval RETURN_INVALID_PARAMETER If Buffer is NULL.
980 If PcdMaximumAsciiStringLength is not
981 zero, and BufferSize is greater than
982 PcdMaximumAsciiStringLength.
983 If unsupported bits are set in Flags.
984 If both COMMA_TYPE and RADIX_HEX are set in
986 If Width >= MAXIMUM_VALUE_CHARACTERS.
991 AsciiValueToStringS (
992 IN OUT CHAR8
*Buffer
,
1000 Returns the number of characters that would be produced by if the formatted
1001 output were produced not including the Null-terminator.
1003 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
1005 If FormatString is NULL, then ASSERT() and 0 is returned.
1006 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more
1007 than PcdMaximumUnicodeStringLength Unicode characters not including the
1008 Null-terminator, then ASSERT() and 0 is returned.
1010 @param[in] FormatString A Null-terminated Unicode format string.
1011 @param[in] Marker VA_LIST marker for the variable argument list.
1013 @return The number of characters that would be produced, not including the
1019 IN CONST CHAR16
*FormatString
,
1024 Returns the number of characters that would be produced by if the formatted
1025 output were produced not including the Null-terminator.
1027 If FormatString is NULL, then ASSERT() and 0 is returned.
1028 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more
1029 than PcdMaximumAsciiStringLength Ascii characters not including the
1030 Null-terminator, then ASSERT() and 0 is returned.
1032 @param[in] FormatString A Null-terminated ASCII format string.
1033 @param[in] Marker VA_LIST marker for the variable argument list.
1035 @return The number of characters that would be produced, not including the
1040 SPrintLengthAsciiFormat (
1041 IN CONST CHAR8
*FormatString
,