From 183161f4db9b1842d35f2eea4b5fa036854b793e Mon Sep 17 00:00:00 2001 From: PatrickvL Date: Fri, 23 Dec 2016 18:25:49 +0100 Subject: [PATCH] Implemented RtlCreateUnicodeString --- import/OpenXDK/include/xboxkrnl/rtl.h | 10 +++++++++- src/CxbxKrnl/EmuKrnlRtl.cpp | 19 +++++++++++++++++++ src/CxbxKrnl/EmuNtDll.cpp | 1 + src/CxbxKrnl/EmuNtDll.h | 10 ++++++++++ src/CxbxKrnl/KernelThunk.cpp | 2 +- 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/import/OpenXDK/include/xboxkrnl/rtl.h b/import/OpenXDK/include/xboxkrnl/rtl.h index e28090fca..d41b67651 100644 --- a/import/OpenXDK/include/xboxkrnl/rtl.h +++ b/import/OpenXDK/include/xboxkrnl/rtl.h @@ -133,7 +133,15 @@ XBSYSAPI EXPORTNUM(273) VOID NTAPI RtlCopyUnicodeString IN PUNICODE_STRING SourceString OPTIONAL ); -XBSYSAPI VOID *RtlCreateUnicodeString; +// ****************************************************************** +// * 0x0112 - RtlCreateUnicodeString() +// ****************************************************************** +XBSYSAPI EXPORTNUM(274) BOOLEAN NTAPI RtlCreateUnicodeString +( + OUT PUNICODE_STRING DestinationString, + IN PCWSTR SourceString +); + XBSYSAPI VOID *RtlDowncaseUnicodeChar; XBSYSAPI VOID *RtlDowncaseUnicodeString; diff --git a/src/CxbxKrnl/EmuKrnlRtl.cpp b/src/CxbxKrnl/EmuKrnlRtl.cpp index 98fc9c78f..d9b1d2a02 100644 --- a/src/CxbxKrnl/EmuKrnlRtl.cpp +++ b/src/CxbxKrnl/EmuKrnlRtl.cpp @@ -337,6 +337,25 @@ XBSYSAPI EXPORTNUM(273) xboxkrnl::VOID NTAPI xboxkrnl::RtlCopyUnicodeString NtDll::RtlCopyUnicodeString((NtDll::PUNICODE_STRING)DestinationString, (NtDll::PUNICODE_STRING)SourceString); } +// ****************************************************************** +// * 0x0112 - RtlCreateUnicodeString() +// ****************************************************************** +XBSYSAPI EXPORTNUM(274) xboxkrnl::BOOLEAN NTAPI xboxkrnl::RtlCreateUnicodeString +( + OUT PUNICODE_STRING DestinationString, + IN PCWSTR SourceString +) +{ + LOG_FUNC_BEGIN + LOG_FUNC_ARG(DestinationString) + LOG_FUNC_ARG(SourceString) + LOG_FUNC_END; + + BOOLEAN result = NtDll::RtlCreateUnicodeString((NtDll::PUNICODE_STRING)DestinationString, (NtDll::PCWSTR)SourceString); + + RETURN(result); +} + // ****************************************************************** // * 0x0115 - RtlEnterCriticalSection() // ****************************************************************** diff --git a/src/CxbxKrnl/EmuNtDll.cpp b/src/CxbxKrnl/EmuNtDll.cpp index 152652d53..e4c27a46d 100644 --- a/src/CxbxKrnl/EmuNtDll.cpp +++ b/src/CxbxKrnl/EmuNtDll.cpp @@ -114,6 +114,7 @@ IMPORT(RtlCompareUnicodeString); IMPORT(RtlCopyString); IMPORT(RtlCopyUnicodeString); IMPORT(RtlCreateHeap); +IMPORT(RtlCreateUnicodeString); IMPORT(RtlDestroyHeap); IMPORT(RtlEnterCriticalSection); IMPORT(RtlEqualString); diff --git a/src/CxbxKrnl/EmuNtDll.h b/src/CxbxKrnl/EmuNtDll.h index f5ed26e99..68cf279ed 100644 --- a/src/CxbxKrnl/EmuNtDll.h +++ b/src/CxbxKrnl/EmuNtDll.h @@ -985,6 +985,15 @@ typedef LONG (NTAPI *FPTR_RtlCopyUnicodeString) IN PUNICODE_STRING SourceString OPTIONAL ); +// ****************************************************************** +// * RtlCreateUnicodeString +// ****************************************************************** +typedef BOOLEAN (NTAPI *FPTR_RtlCreateUnicodeString) +( + OUT PUNICODE_STRING DestinationString, + IN PCWSTR SourceString +); + // ****************************************************************** // * RtlUnicodeStringToAnsiString // ****************************************************************** @@ -1630,6 +1639,7 @@ EXTERN(RtlCompareUnicodeString); EXTERN(RtlCopyString); EXTERN(RtlCopyUnicodeString); EXTERN(RtlCreateHeap); +EXTERN(RtlCreateUnicodeString); EXTERN(RtlDestroyHeap); EXTERN(RtlEnterCriticalSection); EXTERN(RtlEqualString); diff --git a/src/CxbxKrnl/KernelThunk.cpp b/src/CxbxKrnl/KernelThunk.cpp index a54767af3..eb426aa3b 100644 --- a/src/CxbxKrnl/KernelThunk.cpp +++ b/src/CxbxKrnl/KernelThunk.cpp @@ -339,7 +339,7 @@ extern "C" CXBXKRNL_API uint32 CxbxKrnl_KernelThunkTable[379] = (uint32)FUNC(&xboxkrnl::RtlCompareUnicodeString), // 0x010F (271) (uint32)FUNC(&xboxkrnl::RtlCopyString), // 0x0110 (272) (uint32)FUNC(&xboxkrnl::RtlCopyUnicodeString), // 0x0111 (273) - (uint32)PANIC(0x0112), // 0x0112 (274) RtlCreateUnicodeString + (uint32)FUNC(&xboxkrnl::RtlCreateUnicodeString), // 0x0112 (274) (uint32)PANIC(0x0113), // 0x0113 (275) RtlDowncaseUnicodeChar (uint32)PANIC(0x0114), // 0x0114 (276) RtlDowncaseUnicodeString (uint32)FUNC(&xboxkrnl::RtlEnterCriticalSection), // 0x0115 (277)