RtlUnicodeStringToAnsiString

NTSTATUS
RtlUnicodeStringToAnsiString(

IN OUT PANSI_STRING DestinationString,/* optional */
IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString
);

RtlUnicodeStringToAnsiString converts a given Unicode string into an ANSI string. The translation is done in accord with the current system-locale information.

Parameters

DestinationString

Points to a caller-allocated buffer for the ANSI string or is NULL if AllocateDestinationString is set to TRUE. If the translation cannot be done because a character in the Unicode string does not map to an ANSI character in the current system locale, an error is returned.

SourceString

Points 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.

Comments

Callers of RtUnicodeStringToAnsiString must be running at IRQL PASSIVE_LEVEL.

See Also

RtlAnsiStringToUnicodeString, RtlFreeAnsiString