RtlCreateUnicodeString - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTRTL_H

/**
 * The RtlCreateUnicodeString routine creates a new counted Unicode string.
 *
 * \param DestinationString Pointer to the newly allocated and initialized Unicode string.
 * \param SourceString Pointer to a null-terminated Unicode string with which to initialize the new string.
 * \return TRUE if the Unicode string was successfully created, FALSE otherwise.
 * \sa https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-rtlcreateunicodestring
 */
_Success_(return != 0)
_Must_inspect_result_
NTSYSAPI
BOOLEAN
NTAPI
RtlCreateUnicodeString(
    _Out_ PUNICODE_STRING DestinationString,
    _In_z_ PCWSTR SourceString
    );

#endif

View code on GitHub
// ntifs.h

NTSYSAPI BOOLEAN RtlCreateUnicodeString(
  [out] PUNICODE_STRING DestinationString,
  [in]  PCWSTR          SourceString
);
View the official Windows Driver Kit DDI reference

NtDoc

This function is documented in Windows Driver Kit.

Windows Driver Kit DDI reference (nf-ntifs-rtlcreateunicodestring)

RtlCreateUnicodeString function

Description

The RtlCreateUnicodeString routine creates a new counted Unicode string.

Parameters

DestinationString [out]

Pointer to the newly allocated and initialized Unicode string.

SourceString [in]

Pointer to a null-terminated Unicode string with which to initialize the new string.

Return value

RtlCreateUnicodeString returns TRUE if the Unicode string was successfully created, FALSE otherwise.

Remarks

The DestinationString is allocated from paged pool. The caller is responsible for freeing the DestinationString by calling RtlFreeUnicodeString.

For information about other string-handling routines, see the string manipulation functions in Run-Time Library (RTL) Routines.

See also

RtlFreeUnicodeString

UNICODE_STRING