1 out of 2 rated this helpful - Rate this topic

RtlUnicodeStringToAnsiString function

Applies to: desktop apps only

Converts the specified Unicode source string into an ANSI string.

Syntax

NTSTATUS WINAPI RtlUnicodeStringToAnsiString(
  __inout  PANSI_STRING DestinationString,
  __in     PUNICODE_STRING SourceString,
  __in     BOOLEAN AllocateDestinationString
);

Parameters

DestinationString [in, out]

A 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 [in]

The UNICODE_STRING structure that contains the source string to be converted to ANSI.

AllocateDestinationString [in]

Controls allocation of the buffer space for the DestinationString.

TRUE

Buffer space is allocated for DestinationString. If set to TRUE, the buffer must be deallocated using RtlFreeAnsiString.

FALSE

Buffer space is not allocated for DestinationString.

Return value

The various NTSTATUS values are defined in NTSTATUS.H, which is distributed with the DDK.

Return codeDescription
STATUS_SUCCESS

The ANSI string was converted to Unicode. Otherwise, no storage was allocated and no conversion was done.

 

Remarks

The translation is done with respect to the current system locale information.

Because there is no import library for this function, you must use GetProcAddress.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winternl.h

DLL

Ntdll.dll

 

 

Build date: 4/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ