Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CurrentVirtualDesktop fetching from registry #11760

Merged
merged 7 commits into from
Jun 18, 2021

Conversation

manuelserradev
Copy link
Contributor

Fix CurrentVirtualDesktop fetching from registry

What is this about:

On various Windows versions (from 21370.1 upwards) the current virtual desktop id is persisted in:

Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops

Instead of:

Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\SessionInfo\${sessionId}\VirtualDesktops

What is include in the PR:

Fallback check to read the correct registry key.

How does someone test / validate:

See repro steps #11125.

Quality Checklist

Contributor License Agreement (CLA)

A CLA must be signed. If not, go over here and sign the CLA.

@crutkas
Copy link
Member

crutkas commented Jun 15, 2021

@DHowett can you compare how Terminal did this and if we're correct here?

@DHowett
Copy link
Member

DHowett commented Jun 15, 2021

Terminal implemented the check for the new version before the old version.

microsoft/terminal@24bfbe6

@crutkas
Copy link
Member

crutkas commented Jun 16, 2021

@nitroin

  1. Thank you for the work
  2. can you flip the check like Dustin suggested? So new check is before the old like terminal’s?

@manuelserradev
Copy link
Contributor Author

Yep, of course, I'll try to mimic how terminal code behave.

@manuelserradev
Copy link
Contributor Author

PR updated.

Fun fact: the code was already very similar, now is practically the same.
Food for thought: maybe those methods can be extracted in a lib for an SDK-like experience.

@DHowett
Copy link
Member

DHowett commented Jun 17, 2021

Fun fact: the code was already very similar, now is practically the same.

Funny you should mention that! Terminal copy/pasted this from the PT codebase. 😄

@crutkas crutkas merged commit 5679d48 into microsoft:master Jun 18, 2021
royvou pushed a commit to royvou/PowerToys that referenced this pull request Jul 7, 2021
* fix(microsoft#11125): fallback to canonical regkey session unaware

* chore(microsoft#11125): use wil::unique_hkey instead of HKEY for fallback CurrentVirtualDesktop

* refactor: extract new explorer current virtual desktop behavior into a separate method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants