[Xboxkrnl] Use towupper in RtlUpcaseUnicodeChar for portability

std::ctype<char16_t> is a non-standard extension that's not available
on all platforms. Neither this nor the original technically match the
Windows kernel's fixed Unicode table approach and can produce different
results based on system locale.
This commit is contained in:
Herman S.
2026-03-26 21:25:28 +09:00
parent 30fd2a5ac9
commit 597a0c2d1e

View File

@@ -229,8 +229,8 @@ void RtlInitAnsiString_entry(pointer_t<X_ANSI_STRING> destination,
DECLARE_XBOXKRNL_EXPORT1(RtlInitAnsiString, kNone, kImplemented); DECLARE_XBOXKRNL_EXPORT1(RtlInitAnsiString, kNone, kImplemented);
// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlupcaseunicodechar // https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlupcaseunicodechar
dword_result_t RtlUpcaseUnicodeChar_entry(dword_t SourceCharacter) { dword_result_t RtlUpcaseUnicodeChar_entry(dword_t SourceCharacter) {
return std::use_facet<std::ctype<char16_t>>(std::locale()) return static_cast<uint32_t>(std::towupper(
.toupper(SourceCharacter); static_cast<wint_t>(static_cast<uint32_t>(SourceCharacter))));
} }
DECLARE_XBOXKRNL_EXPORT1(RtlUpcaseUnicodeChar, kNone, kImplemented); DECLARE_XBOXKRNL_EXPORT1(RtlUpcaseUnicodeChar, kNone, kImplemented);