[PR #19415] Use the actual process image instead of module filename to dedup session #31836

Closed
opened 2026-01-31 09:49:52 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/19415

State: closed
Merged: Yes


Apparently, GetModuleFileNameW returns exactly the path (or prefix, in case of a DLL) passed to CreateProcess casing and all. Since we were using it to generate the uniquing hash for Portable and Unpackaged instances, this meant that C:\Terminal\wt and C:\TeRmInAl\wt were considered different instances. Whoops.

Using QueryFullProcessImageNameW instead results in canonicalization. Maybe the kernel does it. I don't know. What I do know is that it works more correctly.

(Query... goes through the kernel, while GetModule... goes through the loader. Interesting!)

Closes #19253

**Original Pull Request:** https://github.com/microsoft/terminal/pull/19415 **State:** closed **Merged:** Yes --- Apparently, `GetModuleFileNameW` returns exactly the path (or prefix, in case of a DLL) passed to `CreateProcess` casing and all. Since we were using it to generate the uniquing hash for Portable and Unpackaged instances, this meant that `C:\Terminal\wt` and `C:\TeRmInAl\wt` were considered different instances. Whoops. Using `QueryFullProcessImageNameW` instead results in canonicalization. Maybe the kernel does it. I don't know. What I do know is that it works more correctly. (`Query...` goes through the kernel, while `GetModule...` goes through the loader. Interesting!) Closes #19253
claunia added the pull-request label 2026-01-31 09:49:52 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31836