From e5043dbc054b7114c5a86550a794d19249b5c4ff Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Sun, 17 Dec 2023 20:49:10 -0600 Subject: [PATCH] fix UNICODE_STRING's Buffer variable type issue --- src/core/kernel/common/types.h | 2 +- src/core/kernel/exports/EmuKrnlRtl.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/kernel/common/types.h b/src/core/kernel/common/types.h index ab29c23dd..294bfc96b 100644 --- a/src/core/kernel/common/types.h +++ b/src/core/kernel/common/types.h @@ -266,7 +266,7 @@ typedef struct _UNICODE_STRING { ushort_xt Length; ushort_xt MaximumLength; - ushort_xt *Buffer; + wchar_xt *Buffer; } UNICODE_STRING, *PUNICODE_STRING; diff --git a/src/core/kernel/exports/EmuKrnlRtl.cpp b/src/core/kernel/exports/EmuKrnlRtl.cpp index c5991807b..f45785a65 100644 --- a/src/core/kernel/exports/EmuKrnlRtl.cpp +++ b/src/core/kernel/exports/EmuKrnlRtl.cpp @@ -114,7 +114,7 @@ XBSYSAPI EXPORTNUM(260) xbox::ntstatus_xt NTAPI xbox::RtlAnsiStringToUnicodeStri DestinationString->Length = (USHORT)(total - sizeof(WCHAR)); if (AllocateDestinationString) { DestinationString->MaximumLength = (USHORT)total; - if (!(DestinationString->Buffer = (USHORT*)ExAllocatePoolWithTag(total, 'grtS'))) { + if (!(DestinationString->Buffer = (wchar_xt*)ExAllocatePoolWithTag(total, 'grtS'))) { RETURN(X_STATUS_NO_MEMORY); } } @@ -657,7 +657,7 @@ XBSYSAPI EXPORTNUM(274) xbox::boolean_xt NTAPI xbox::RtlCreateUnicodeString BOOLEAN result = TRUE; ULONG bufferSize = (std::u16string(SourceString).length() + 1) * sizeof(WCHAR); - DestinationString->Buffer = (USHORT *)ExAllocatePoolWithTag(bufferSize, 'grtS'); + DestinationString->Buffer = (wchar_xt*)ExAllocatePoolWithTag(bufferSize, 'grtS'); if (!DestinationString->Buffer) { result = FALSE; } @@ -705,7 +705,7 @@ XBSYSAPI EXPORTNUM(276) xbox::ntstatus_xt NTAPI xbox::RtlDowncaseUnicodeString if (AllocateDestinationString) { DestinationString->MaximumLength = SourceString->Length; - DestinationString->Buffer = (USHORT*)ExAllocatePoolWithTag((ULONG)DestinationString->MaximumLength, 'grtS'); + DestinationString->Buffer = (wchar_xt*)ExAllocatePoolWithTag((ULONG)DestinationString->MaximumLength, 'grtS'); if (DestinationString->Buffer == NULL) { return X_STATUS_NO_MEMORY; } @@ -1178,9 +1178,9 @@ XBSYSAPI EXPORTNUM(290) xbox::void_xt NTAPI xbox::RtlInitUnicodeString LOG_FUNC_ARG(SourceString) LOG_FUNC_END; - DestinationString->Buffer = (USHORT*)SourceString; + DestinationString->Buffer = (wchar_xt*)SourceString; if (SourceString != NULL) { - DestinationString->Buffer = (USHORT*)SourceString; + DestinationString->Buffer = (wchar_xt*)SourceString; DestinationString->Length = (USHORT)std::u16string(SourceString).length() * 2; DestinationString->MaximumLength = DestinationString->Length + 2; } @@ -2030,7 +2030,7 @@ XBSYSAPI EXPORTNUM(314) xbox::ntstatus_xt NTAPI xbox::RtlUpcaseUnicodeString if (AllocateDestinationString) { DestinationString->MaximumLength = SourceString->Length; - DestinationString->Buffer = (USHORT*)ExAllocatePoolWithTag((ULONG)DestinationString->MaximumLength, 'grtS'); + DestinationString->Buffer = (wchar_xt*)ExAllocatePoolWithTag((ULONG)DestinationString->MaximumLength, 'grtS'); if (DestinationString->Buffer == NULL) { return X_STATUS_NO_MEMORY; }