RtlAnsiStringToUnicodeString

NTSTATUS
    RtlAnsiStringToUnicodeString(

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

RtlAnsiStringToUnicodeString converts the given ANSI source string into a Unicode string. The translation conforms to the current system locale information.

Parameters

DestinationString
Points to a caller-allocated buffer for a converted Unicode string or a NULL pointer if AllocateDestinationString is TRUE. This routine sets the length field of DestinationString only if AllocateDestinationString is TRUE.
SourceString
Points to the ANSI string to be converted to Unicode.
AllocateDestinationString
Is TRUE if this routine should allocate the buffer space for the destination string. If it does, the caller must deallocate the buffer by calling RtlFreeUnicodeString.

Return Value

If the conversion succeeds, RtlAnsiStringToUnicodeString returns STATUS_SUCCESS. Otherwise, no storage was allocated, nor was the conversion performed.

Comments

Only storage for the DestinationString buffer can be allocated by this routine. The caller must supply the buffer for the input SourceString.

Callers of RtlAnsiStringToUnicodeString must be running at IRQL PASSIVE_LEVEL.

See Also

RtlAnsiStringToUnicodeSize, RtlFreeUnicodeString, RtlInitAnsiString, RtlUnicodeStringToAnsiString