RtlUnicodeStringToOemString function (winternl.h)

Converts the specified Unicode source string into an OEM string. The translation is done with respect to the OEM code page (OCP).


NTSTATUS RtlUnicodeStringToOemString(
  [out] POEM_STRING      DestinationString,
  [in]  PCUNICODE_STRING SourceString,
  [in]  BOOLEAN          AllocateDestinationString


[out] DestinationString

A pointer to an OEM_STRING structure that is contains the OEM equivalent to the Unicode source string. The MaximumLength field is set if AllocateDestinationString is TRUE.

[in] SourceString

A pointer to an UNICODE_STRING structure that is to be converted to OEM.

[in] AllocateDestinationString

Controls allocation of the buffer space for the destination string.


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


Buffer space is not allocated for DestinationString.

Return value

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

Return code Description
The Unicode string was converted to OEM. Otherwise, no storage was allocated, and no conversion was done.


This routine allocates a buffer for the DestinationString only.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winternl.h
DLL Ntdll.dll