RtlUnicodeStringToAnsiString function

The RtlUnicodeStringToAnsiString routine converts a given Unicode string into an ANSI string.

Syntax

NTSYSAPI NTSTATUS RtlUnicodeStringToAnsiString(
  PANSI_STRING     DestinationString,
  PCUNICODE_STRING SourceString,
  BOOLEAN          AllocateDestinationString
);

Parameters

DestinationString

Pointer to an ANSI_STRING structure to hold the converted ANSI string. If AllocateDestinationString is TRUE, the routine allocates a new buffer to hold the string data, and updates the Buffer member of DestinationString to point to the new buffer. Otherwise, the routine uses the currently specified buffer to hold the string.

SourceString

Pointer to the Unicode source string to be converted to ANSI.

AllocateDestinationString

TRUE if this routine is to allocate the buffer space for the DestinationString. If it does, the buffer must be deallocated by calling RtlFreeAnsiString.

Return Value

If the conversion succeeds, RtlUnicodeStringToAnsiString returns STATUS_SUCCESS. Otherwise, no storage was allocated, and no conversion was done.

Remarks

The translation is done in accord with the current system-locale information.

Requirements

   
Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL

See Also

ANSI_STRING

RtlAnsiStringToUnicodeString

RtlFreeAnsiString

UNICODE_STRING