RtlUnicodeStringToOemString - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTRTL_H

NTSYSAPI
NTSTATUS
NTAPI
RtlUnicodeStringToOemString(
    _Inout_ POEM_STRING DestinationString,
    _In_ PCUNICODE_STRING SourceString,
    _In_ BOOLEAN AllocateDestinationString
    );

#endif

View code on GitHub
// ntifs.h

NTSYSAPI NTSTATUS RtlUnicodeStringToOemString(
       POEM_STRING      DestinationString,
  [in] PCUNICODE_STRING SourceString,
  [in] BOOLEAN          AllocateDestinationString
);
View the official Windows Driver Kit DDI reference
// winternl.h

NTSTATUS RtlUnicodeStringToOemString(
  [out] POEM_STRING      DestinationString,
  [in]  PCUNICODE_STRING SourceString,
  [in]  BOOLEAN          AllocateDestinationString
);
View the official Win32 API reference

NtDoc

This function is documented in Windows Driver Kit.

Windows Driver Kit DDI reference (nf-ntifs-rtlunicodestringtooemstring)

RtlUnicodeStringToOemString function

Description

The RtlUnicodeStringToOemString routine translates a given Unicode source string into an OEM string using the current system OEM code page.

Parameters

DestinationString

Pointer to a caller-allocated buffer to receive the OEM string. If AllocateDestinationString is FALSE, the caller must also allocate a buffer for the Buffer member of DestinationString to hold the OEM data. If AllocateDestinationString is TRUE, RtlUnicodeStringToOemString allocates a buffer large enough to hold the string, passes a pointer to it in Buffer, and updates the length and maximum length members of DestinationString accordingly.

SourceString [in]

Pointer to the Unicode string to be translated.

AllocateDestinationString [in]

Set to TRUE if RtlUnicodeStringToOemString should allocate the buffer space for the DestinationString, FALSE otherwise. If this parameter is TRUE, the caller is responsible for freeing the buffer when it is no longer needed by calling RtlFreeOemString.

Return value

RtlUnicodeStringToOemString returns STATUS_SUCCESS if the string at DestinationString is translated. Otherwise, no storage was allocated, and no conversion was performed.

Remarks

RtlUnicodeStringToOemString translates the given source string using the OEM code page that was installed as the current system code page at system boot time.

RtlUnicodeStringToOemString does not modify the source string. It returns a null-terminated OEM string.

For information about other string-handling routines, see Run-Time Library (RTL) Routines.

See also

OEM_STRING

RtlFreeOemString

RtlUnicodeStringToCountedOemString

RtlUnicodeStringToOemSize

RtlUnicodeToOemN

RtlUpcaseUnicodeStringToOemString

UNICODE_STRING


Win32 API reference (nf-winternl-rtlunicodestringtooemstring)

RtlUnicodeStringToOemString function

Description

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

Parameters

DestinationString [out]

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.

SourceString [in]

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

AllocateDestinationString [in]

Controls allocation of the buffer space for the destination string.

TRUE

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

FALSE

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
STATUS_SUCCESS The Unicode string was converted to OEM. Otherwise, no storage was allocated, and no conversion was done.

Remarks

This routine allocates a buffer for the DestinationString only.