Skip to content

Respect the codepage stored in .LNK files in conhost - #15111

Merged
Dustin L. Howett (DHowett) merged 3 commits into
microsoft:mainfrom
michalnpl:dev/michalnpl/14942_Conhost_doesnt_honour_the_codepage_stored_in_shortcuts_fix
Apr 6, 2023
Merged

Dustin L. Howett (DHowett) merged 3 commits into
microsoft:mainfrom
michalnpl:dev/michalnpl/14942_Conhost_doesnt_honour_the_codepage_stored_in_shortcuts_fix

Conversation

@michalnpl

@michalnpl michalnpl commented Apr 4, 2023 •

Copy link
Copy Markdown
Contributor

Making Conhost pick up codepage from .lnk files.

Because of the wrong assignment order, the Conhost was not picking up the codepage stored in .lnk shortcut files. This change fixes this issue by changing the order of the assignment to the correct one.

This is a potential backward compatibility issue.

Since this issue has been present in the codebase for years, this change runs a high risk of breaking backward compatibility with software that depends on incorrect behavior.

Validation Steps Performed

Tested fix manually (using chcp command, making sure each .lnk codepage was picked up.) against Debug/Release x64 builds with 5 different .lnk files:

  1. Arabic codepage 1256
  2. Greek 869
  3. Latin2 852
  4. Thai 874
  5. Traditional Chinese 50229

Ran TAEF tests against Debug/Release x64/x86 with identical results as main branch.

Tested against invalid codepage numbers by manually manipulating .lnk file binary. In case of an invalid codepage number, Conhost defaults to a valid default one, which I assume is expected behavior.

Closes #14942

@microsoft-github-policy-service microsoft-github-policy-service Bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Conhost For issues in the Console codebase Impact-Correctness It be wrong. labels Apr 4, 2023
…/michalnpl/14942_Conhost_doesnt_honour_the_codepage_stored_in_shortcuts_fix
@michalnpl
michalnpl marked this pull request as ready for review April 4, 2023 21:49
@DHowett Dustin L. Howett (DHowett) changed the title 14942 Fix for Conhost not honoring codepages stored in .lnk shortcuts. Respect the codepage stored in .LNK files in conhost Apr 6, 2023
@DHowett

Copy link
Copy Markdown
Member

Moved from body of PR


Test files are attached:.
ShortcutsWithDifferentCodepages.zip


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for doing this! I suspected the hard/annoying part would be the testing, and I'm so glad you did it. I'm going to put a note on https://github.com/microsoft/terminal/wiki/Console:-Potential-Breaking-Changes for it.

@DHowett
Dustin L. Howett (DHowett) merged commit e73362d into microsoft:main Apr 6, 2023
@michalnpl
michalnpl deleted the dev/michalnpl/14942_Conhost_doesnt_honour_the_codepage_stored_in_shortcuts_fix branch April 7, 2023 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Impact-Correctness It be wrong. Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Conhost For issues in the Console codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conhost doesn't honour the codepage stored in shortcuts

4 participants