Skip to content

Windows 11 Bug in RtlUnicodeStringToOemString  #15038

@leecher1337

Description

@leecher1337

Windows Terminal version

No response

Windows build number

10.0.22000.1696

Other Software

No response

Steps to reproduce

  1. In my example, I'm using a German Windows 11 System which has default OEM Codepage CP850
  2. Enable Legacy console mode:

image

  1. Enable raster font:
    image

  2. Restart console so that it start up.
    Now try to Type Umlauts on your keyboard:

image

All Applications that are using RtlUnicodeStringToOemString API are also affected, i.e. File Save support on NTVDMx64

The bug is due to the incorrect codepage being used in RtlOemToUnicodeN API. The codepage gets properly initialized in RtlpInitCodePageTables, but doesn't get used lateron.
Here is a detailled description of the bug, fixing it should be trivial by using the correct codepage:
Analysis
It also contains a test program.

The bug wasn't there on Windows 10 but seems to have been introduced in Win 11 which also introduced other bugs in the Console Host by removal of the NLS Tables in the PEB which I'm also mentioning for the sake of completeness:

( Sidenote:
The removal of the OemCodePageData pointer from PEB in Windows 11 leads to a crash in ConHost V1 when using OEM codepage there, because GlyphCP doesn't get initialized due to the lack of PEB->OemCodePageData.
This in turn leads to crashes in conhost functions:

         ConvertOutputToUnicode
         FalseUnicodeToRealUnicode
         SB_CharToWcharGlyph

The practical result is that conhost crashes when i.e. not using raster font in console, but TTF like "Lucidia Console" and console application runs with OEM codepage.
)

Here is a complied version of the program that is mentioned in the problem analysis description in order to test:
nlstest.zip

Expected Behavior

Entering Umlauts on the keyboard should display the correct Umlauts:

image

Actual Behavior

See above.

Metadata

Metadata

Assignees

Labels

Issue-BugIt either shouldn't be doing this or needs an investigation.Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions