RtlUnicodeToMultiByteSize function (winternl.h)

Determines how many bytes are needed to represent a Unicode string as an ANSI string.

Syntax

NTSTATUS RtlUnicodeToMultiByteSize(
  [out] PULONG BytesInMultiByteString,
  [in]  PWCH   UnicodeString,
  [in]  ULONG  BytesInUnicodeString
);

Parameters

[out] BytesInMultiByteString

Returns the number of bytes for the ANSI equivalent of the Unicode string pointed to by UnicodeString. This number does not include the terminating NULL character.

[in] UnicodeString

The Unicode source string for which the ANSI length is calculated.

[in] BytesInUnicodeString

The number of bytes in the string pointed to by UnicodeString.

Return value

Return code Description
STATUS_SUCCESS
The count was successful. The various NTSTATUS values are defined in NTSTATUS.H, which is distributed with the Windows DDK.

Remarks

It is recommended that you use WideCharToMultiByte instead of RtlUnicodeToMultiByteSize. When its cbMultiByte parameter is set to zero, the WideCharToMultiByte function returns the number of bytes required for the buffer.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winternl.h
Library ntdll.lib
DLL ntdll.dll