RtlUnicodeStringVPrintf function

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


NTSTATUS RtlUnicodeStringVPrintf(
  _Out_ PUNICODE_STRING  DestinationString,
  _In_  NTSTRSAFE_PCWSTR pszFormat,
  _In_  va_list          argList
);

Parameters

DestinationString [out]

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.

pszFormat [in]

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

argList [in]

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 codeDescription
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

Target platform

Desktop

Version

Available in Windows XP with Service Pack 1 (SP1) and later versions of Windows.

Header

Ntstrsafe.h (include Ntstrsafe.h)

Library

Ntstrsafe.lib

IRQL

PASSIVE_LEVEL

See also

RtlUnicodeStringPrintf
RtlUnicodeStringPrintfEx
RtlUnicodeStringVPrintfEx
UNICODE_STRING

 

 

Send comments about this topic to Microsoft

Show: