RtlUnicodeToOemN - NtDoc

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

NTSYSAPI
NTSTATUS
NTAPI
RtlUnicodeToOemN(
    _Out_writes_bytes_to_(MaxBytesInOemString, *BytesInOemString) PCHAR OemString,
    _In_ ULONG MaxBytesInOemString,
    _Out_opt_ PULONG BytesInOemString,
    _In_reads_bytes_(BytesInUnicodeString) PCWCH UnicodeString,
    _In_ ULONG BytesInUnicodeString
    );

#endif

View code on GitHub
// ntifs.h

NTSYSAPI NTSTATUS RtlUnicodeToOemN(
  [out]           PCHAR  OemString,
  [in]            ULONG  MaxBytesInOemString,
  [out, optional] PULONG BytesInOemString,
  [in]            PCWCH  UnicodeString,
  [in]            ULONG  BytesInUnicodeString
);
View the official Windows Driver Kit DDI reference

NtDoc

This function is documented in Windows Driver Kit.

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

RtlUnicodeToOemN function

Description

The RtlUnicodeToOemN routine translates a given Unicode string to an OEM string, using the current system OEM code page.

Parameters

OemString [out]

Pointer to a caller-allocated buffer to receive the translated string.

MaxBytesInOemString [in]

Maximum number of bytes to be written to OemString.

BytesInOemString [out, optional]

Pointer to a caller-allocated variable that receives the number of bytes in the translated string. This parameter can be NULL.

UnicodeString [in]

Pointer to the Unicode source string to be translated.

BytesInUnicodeString [in]

Size, in bytes, of the string at UnicodeString.

Return value

RtlUnicodeToOemN returns STATUS_SUCCESS if the full string at UnicodeString was translated and returned at OemString.

Remarks

For the return value STATUS_BUFFER_OVERFLOW, the truncated string at OemString was translated without error.

For the return value STATUS_SUCCESS, the value at BytesInOemString, if any, indicates the length of the returned string, rather than the given MaxBytesInOemString.

RtlUnicodeToOemN does not modify the source string. It returns a null-terminated OEM string if the given BytesInUnicodeString included a NULL terminator and if the given MaxBytesInOemString did not cause truncation.

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

See also

RtlOemToUnicodeN

RtlUnicodeStringToCountedOemString

RtlUnicodeStringToOemString