diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc index 7ac9cd05c..86852889b 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc @@ -186,6 +186,40 @@ void RtlFreeUnicodeString(pointer_t string) { } DECLARE_XBOXKRNL_EXPORT(RtlFreeUnicodeString, ExportTag::kImplemented); +void RtlCopyString(pointer_t destination, + pointer_t source) { + if (!source) { + destination->length = 0; + return; + } + + auto length = std::min(destination->maximum_length, source->length); + if (length > 0) { + auto dst_buf = kernel_memory()->TranslateVirtual(destination->pointer); + auto src_buf = kernel_memory()->TranslateVirtual(source->pointer); + std::memcpy(dst_buf, src_buf, length); + } + destination->length = length; +} +DECLARE_XBOXKRNL_EXPORT(RtlCopyString, ExportTag::kImplemented); + +void RtlCopyUnicodeString(pointer_t destination, + pointer_t source) { + if (!source) { + destination->length = 0; + return; + } + + auto length = std::min(destination->maximum_length, source->length); + if (length > 0) { + auto dst_buf = kernel_memory()->TranslateVirtual(destination->pointer); + auto src_buf = kernel_memory()->TranslateVirtual(source->pointer); + std::memcpy(dst_buf, src_buf, length * 2); + } + destination->length = length; +} +DECLARE_XBOXKRNL_EXPORT(RtlCopyUnicodeString, ExportTag::kImplemented); + // http://msdn.microsoft.com/en-us/library/ff562969 dword_result_t RtlUnicodeStringToAnsiString( pointer_t destination_ptr,