Skip to content

Conversation

@DHowett
Copy link
Member

@DHowett DHowett commented Oct 6, 2025

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

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.

Closes #19253
Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Thank you!

@DHowett
Copy link
Member Author

DHowett commented Oct 7, 2025

Why, you're welcome!

@DHowett DHowett merged commit 9d7ea77 into main Oct 7, 2025
17 of 19 checks passed
DHowett added a commit that referenced this pull request Oct 8, 2025
…ion (#19415)

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

(cherry picked from commit 9d7ea77)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgfkTus
Service-Version: 1.23
DHowett added a commit that referenced this pull request Oct 8, 2025
…ion (#19415)

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

(cherry picked from commit 9d7ea77)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgfkTuo
Service-Version: 1.24
dongle-the-gadget pushed a commit to dongle-the-gadget/terminal that referenced this pull request Oct 9, 2025
…ion (microsoft#19415)

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 microsoft#19253
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.

"Attach to the most recently used window" not working in preview

3 participants