Skip to content

Set AppUserModelID for unpackaged#20018

Merged
carlos-zamora merged 4 commits intomainfrom
dev/cazamor/aumid
Mar 27, 2026
Merged

Set AppUserModelID for unpackaged#20018
carlos-zamora merged 4 commits intomainfrom
dev/cazamor/aumid

Conversation

@carlos-zamora
Copy link
Copy Markdown
Member

@carlos-zamora carlos-zamora commented Mar 25, 2026

Summary of the Pull Request

Does what it says on the tin. Sets the AUMID to WindowsTerminal.<hash> with a slightly different prefix based on the branding. The hash is based on the full process image name and user SID.

Extracted from #20013

#endif
const auto path = wil::QueryFullProcessImageNameW<std::wstring>();
const auto hash = til::hash(path);
fmt::format_to(std::back_inserter(aumid), FMT_COMPILE(L".{:016x}"), hash);
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.

what does this do on x86? just have a bunch of 0s in?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

til::hash returns a size_t, so {:016x} would have the first 8 digits be 0s.

That said, I added the #ifdef _WIN64 branches for consistency with the other places that's done in this file.

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.

If you move this up, before the GetCurrentProcessToken block, couldn't you just use the windowClassName as an argument to SetCurrentProcessExplicitAppUserModelID?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry for missing this! We wouldn't be able to use the windowClassName as the AUMID because it can't contain spaces (reference).

That said, I can reuse the ifdefs to set the aumid, IsPackaged() check, and hash. Making the change now.

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.

You can also just remove the spaces from the window class! It bears no real meaning.

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.

I'm OK with having them be separate for now.

@carlos-zamora carlos-zamora enabled auto-merge (squash) March 25, 2026 20:21
Copy link
Copy Markdown
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

(also worth looking at Leonard's comment!)

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Mar 26, 2026
@carlos-zamora
Copy link
Copy Markdown
Member Author

/azp run

1 similar comment
@carlos-zamora
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@carlos-zamora carlos-zamora merged commit eea035c into main Mar 27, 2026
18 of 20 checks passed
@carlos-zamora carlos-zamora deleted the dev/cazamor/aumid branch March 27, 2026 18:52
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