Skip to content

Commit 96f13a1

Browse files
committed
Use the actual process image instead of module filename to dedup session (#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
1 parent 5fa2718 commit 96f13a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cascadia/WindowsTerminal/WindowEmperor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ void WindowEmperor::HandleCommandlineArgs(int nCmdShow)
315315
}
316316
if (!IsPackaged())
317317
{
318-
const auto path = wil::GetModuleFileNameW<std::wstring>(nullptr);
318+
const auto path = wil::QueryFullProcessImageNameW<std::wstring>();
319319
const auto hash = til::hash(path);
320320
#ifdef _WIN64
321321
fmt::format_to(std::back_inserter(windowClassName), FMT_COMPILE(L" {:016x}"), hash);

0 commit comments

Comments
 (0)