RtlUnicodeStringVPrintf function (ntstrsafe.h)

The RtlUnicodeStringVPrintf function creates a text string, with formatting that is based on supplied formatting information, and stores the string in a UNICODE_STRING structure.

Syntax

NTSTRSAFEDDI RtlUnicodeStringVPrintf(
  [out] PUNICODE_STRING  DestinationString,
  [in]  NTSTRSAFE_PCWSTR pszFormat,
  [in]  va_list          argList
);

Parameters

[out] DestinationString

A pointer to a UNICODE_STRING structure that receives a formatted string. RtlUnicodeStringVPrintf creates this string from the formatting string that pszFormat specifies and the function's argument list. The maximum number of characters in the string is NTSTRSAFE_UNICODE_STRING_MAX_CCH.

[in] pszFormat

A pointer to a null-terminated text string that contains printf-styled formatting directives.

[in] argList

A va_list-typed argument list. Arguments in this argument list will be interpreted by using the formatting string that pszFormat specifies.

Return value

RtlUnicodeStringVPrintf returns one of the following NTSTATUS values.

Return code Description
STATUS_SUCCESS
This success status means source data was present, the string was copied without truncation, and the resultant destination buffer is null-terminated.
STATUS_BUFFER_OVERFLOW
This warning status means the copy operation did not complete due to insufficient buffer space. The destination buffer contains a truncated, null-terminated version of the intended result.
STATUS_INVALID_PARAMETER
This error status means the function received an invalid input parameter. For more information, see the following paragraph.
 

RtlUnicodeStringVPrintf returns the STATUS_INVALID_PARAMETER value when one of the following occurs:

  • The contents of the UNICODE_STRING structure that DestinationString points to are invalid.
  • The destination buffer is already full.
  • A NULL pointer is present.
  • The destination buffer's length is zero, but a nonzero length source string is present.
For information about how to test NTSTATUS values, see Using NTSTATUS Values.

Remarks

The RtlUnicodeStringVPrintf function uses the destination buffer's size to ensure that the string formatting operation does not write past the end of the buffer. The function does not terminate the resultant string with a null character.

If the format string and destination string overlap, the behavior of the function is undefined.

The pszFormat and DestinationString pointers cannot be NULL. If you need to handle NULL pointer values, use the RtlUnicodeStringVPrintfEx function.

For more information about the safe string functions, see Using Safe String Functions.

Requirements

Requirement Value
Minimum supported client Available in Windows XP with Service Pack 1 (SP1) and later versions of Windows.
Target Platform Desktop
Header ntstrsafe.h (include Ntstrsafe.h)
Library Ntstrsafe.lib
IRQL PASSIVE_LEVEL

See also

RtlUnicodeStringPrintf

RtlUnicodeStringPrintfEx

RtlUnicodeStringVPrintfEx

UNICODE_STRING