#ifndef _NTRTL_H
NTSYSAPI
NTSTATUS
NTAPI
RtlUnicodeStringToOemString(
_Inout_ POEM_STRING DestinationString,
_In_ PCUNICODE_STRING SourceString,
_In_ BOOLEAN AllocateDestinationString
);
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
This function is documented in Windows Driver Kit.
The RtlUnicodeStringToOemString routine translates a given Unicode source string into an OEM string using the current system OEM code page.
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.
RtlUnicodeStringToOemString returns STATUS_SUCCESS if the string at DestinationString is translated. Otherwise, no storage was allocated, and no conversion was performed.
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.
RtlUnicodeStringToCountedOemString
RtlUpcaseUnicodeStringToOemString
Converts the specified Unicode source string into an OEM string. The translation is done with respect to the OEM code page (OCP).
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.
Buffer space is allocated for DestinationString. If set to TRUE, the buffer must be deallocated using RtlFreeOemString.
Buffer space is not allocated for DestinationString.
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. |
This routine allocates a buffer for the DestinationString only.