mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-13 21:42:26 -06:00
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 9d7ea77cc8ecbfcf213f6a38fbeb611c71040a34) Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgfkTus Service-Version: 1.23
This commit is contained in:
parent
5fa2718b2f
commit
96f13a15de
@ -315,7 +315,7 @@ void WindowEmperor::HandleCommandlineArgs(int nCmdShow)
|
|||||||
}
|
}
|
||||||
if (!IsPackaged())
|
if (!IsPackaged())
|
||||||
{
|
{
|
||||||
const auto path = wil::GetModuleFileNameW<std::wstring>(nullptr);
|
const auto path = wil::QueryFullProcessImageNameW<std::wstring>();
|
||||||
const auto hash = til::hash(path);
|
const auto hash = til::hash(path);
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
fmt::format_to(std::back_inserter(windowClassName), FMT_COMPILE(L" {:016x}"), hash);
|
fmt::format_to(std::back_inserter(windowClassName), FMT_COMPILE(L" {:016x}"), hash);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user