Skip to content

Include the hash of the SID in the Window Class and Mutant #19109

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

Merged
merged 1 commit into from
Jul 8, 2025

Conversation

DHowett
Copy link
Member

@DHowett DHowett commented Jul 8, 2025

Right now, we do not use a sufficiently unique name to disambiguate Terminal instances running on the same desktop.

Mutexes (mutants) are named objects that live in the user's session, under Sessions\1\BaseNamedObjects (for the local desktop session). When multiple users are logged into the same session--such as with "Run as different user"--they share a local BaseNamedObjects namespace. Ugh.

We cannot use CreatePrivateNamespace as it requires a boundary descriptor, and the only boundary descriptors supported by the current API are based on package identity. I also fear that CreatePrivateNamespace is subject to a race condition with OpenPrivateNamespace; Create will not Open an existing one, so we would need to back off and retry either opening or creating. Yuck.

After this commit, we will hash the user's SID into the name of both the window class and the mutant, right after the path hash (if running unpackaged).

Closes #18704

@DHowett
Copy link
Member Author

DHowett commented Jul 8, 2025

image

Screenshot from WinObj

@DHowett DHowett merged commit 02f173d into main Jul 8, 2025
19 checks passed
@DHowett DHowett deleted the dev/duhowett/window-sid branch July 8, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants