in phnt/include/ntrtl.h [1469:1492]
FORCEINLINE NTSTATUS RtlInitUnicodeStringEx(
_Out_ PUNICODE_STRING DestinationString,
_In_opt_z_ PCWSTR SourceString
)
{
size_t stringLength;
DestinationString->Length = 0;
DestinationString->Buffer = (PWCH)SourceString;
if (!SourceString)
return STATUS_SUCCESS;
stringLength = wcslen(SourceString);
if (stringLength <= UNICODE_STRING_MAX_CHARS - 1)
{
DestinationString->Length = (USHORT)stringLength * sizeof(WCHAR);
DestinationString->MaximumLength = DestinationString->Length + sizeof(UNICODE_NULL);
return STATUS_SUCCESS;
}
return STATUS_NAME_TOO_LONG;
}