From c309bd769d19b4991505f8195a562be161f09006 Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Wed, 24 Jun 2026 09:48:39 +0200 Subject: [PATCH] Export Unicode string support functions --- xtoskrnl/rtl/exports.cc | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/xtoskrnl/rtl/exports.cc b/xtoskrnl/rtl/exports.cc index c2e5f74..a7d40cb 100644 --- a/xtoskrnl/rtl/exports.cc +++ b/xtoskrnl/rtl/exports.cc @@ -392,6 +392,29 @@ RtlCopyString(IN PCHAR Destination, RTL::String::CopyString(Destination, Source, Length); } +/** + * Copies a source Unicode string to a destination Unicode string. + * + * @param Destination + * Supplies a pointer to the destination string. + * + * @param Source + * Supplies an optional pointer to the source string. If this parameter is not provided, + * the destination string is effectively emptied. + * + * @return This routine does not return any value. + * + * @since NT 3.5 + */ +XTCLINK +XTAPI +VOID +RtlCopyUnicodeString(IN OUT PUNICODE_STRING Destination, + IN PCUNICODE_STRING Source) +{ + RTL::Unicode::CopyString(Destination, Source); +} + /** * Copies a wide string from a buffer into another buffer, ensuring that the destination string is NULL-terminated. * @@ -628,6 +651,50 @@ RtlInitializeListHead(IN PLIST_ENTRY ListHead) RTL::LinkedList::InitializeListHead(ListHead); } +/** + * Initializes a Unicode string. + * + * @param Destination + * Supplies a pointer to the UNICODE_STRING structure to be initialized. + * + * @param Source + * Supplies an optional pointer to a NULL-terminated wide character string. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTCLINK +XTAPI +VOID +RtlInitializeUnicodeString(OUT PUNICODE_STRING Destination, + IN PCWSTR Source) +{ + RTL::Unicode::InitializeString(Destination, Source, TRUE); +} + +/** + * Initializes a Unicode string. + * + * @param Destination + * Supplies a pointer to the UNICODE_STRING structure to be initialized. + * + * @param Source + * Supplies an optional pointer to a NULL-terminated wide character string. + * + * @return This routine returns a status code indicating the success or failure of the operation. + * + * @since XT 1.0 + */ +XTCLINK +XTAPI +XTSTATUS +RtlInitializeUnicodeStringEx(OUT PUNICODE_STRING Destination, + IN PCWSTR Source) +{ + return RTL::Unicode::InitializeString(Destination, Source); +} + /** * This routine inserts an entry at the head of a doubly linked list. *