Expand Minimize

RtlAnsiStringToUnicodeString function

RtlAnsiStringToUnicodeString converts the given ANSI source string into a Unicode string.

Syntax


NTSTATUS RtlAnsiStringToUnicodeString(
  _Inout_  PUNICODE_STRING DestinationString,
  _In_     PCANSI_STRING SourceString,
  _In_     BOOLEAN AllocateDestinationString
);

Parameters

DestinationString [in, out]

Pointer to a UNICODE_STRING structure to hold the converted Unicode 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 [in]

Pointer to the ANSI string to be converted to Unicode.

AllocateDestinationString [in]

Specifies 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. On failure, the routine does not allocate any memory.

Remarks

The translation conforms to the current system locale information.

If caller sets AllocateDestinationString to TRUE, the routine replaces the Buffer member of DestinationString with a pointer to the buffer it allocates. The old value can be overwritten even when the routine returns an error status code.

Requirements

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

PASSIVE_LEVEL

See also

ANSI_STRING
UNICODE_STRING
RtlAnsiStringToUnicodeSize
RtlFreeUnicodeString
RtlInitAnsiString
RtlUnicodeStringToAnsiString

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft