RtlMultiByteToUnicodeSize function (ntifs.h)

The RtlMultiByteToUnicodeSize routine determines the number of bytes that are required to store the Unicode translation for the specified source string. The translation is assumed to use the current system ANSI code page (ACP). The source string is not necessarily from a multibyte character set.

Syntax

NTSYSAPI NTSTATUS RtlMultiByteToUnicodeSize(
  [out] PULONG     BytesInUnicodeString,
  [in]  const CHAR *MultiByteString,
  [in]  ULONG      BytesInMultiByteString
);

Parameters

[out] BytesInUnicodeString

Pointer to a caller-allocated variable that receives the number of bytes that are required to store the translated string.

[in] MultiByteString

Pointer to the source string for which the Unicode length is to be calculated.

[in] BytesInMultiByteString

Length, in bytes, of the source string.

Return value

RtlMultiByteToUnicodeSize returns STATUS_SUCCESS.

Remarks

RtlMultiByteToUnicodeSize can be called to determine how much memory to allocate, or possibly, the value to specify for MaxBytesInUnicodeString, before translating a multibyte string into Unicode with RtlMultiByteToUnicodeN. The returned value does not include space for a NULL terminator for the Unicode string.

Like RtlMultiByteToUnicodeN, RtlMultiByteToUnicodeSize supports only precomposed Unicode characters that are mapped to the current system ANSI code page installed at system boot.

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

Requirements

Requirement Value
Target Platform Universal
Header ntifs.h (include Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL < DISPATCH_LEVEL

See also

RtlMultiByteToUnicodeN

RtlUnicodeToMultiByteSize