diff --git a/src/cascadia/TerminalSettingsModel/WslDistroGenerator.cpp b/src/cascadia/TerminalSettingsModel/WslDistroGenerator.cpp index 2b656154adf..50285fd8243 100644 --- a/src/cascadia/TerminalSettingsModel/WslDistroGenerator.cpp +++ b/src/cascadia/TerminalSettingsModel/WslDistroGenerator.cpp @@ -19,6 +19,7 @@ static constexpr std::wstring_view RancherDistributionPrefix{ L"rancher-desktop" // ⌞ DistributionName: {the name} static constexpr wchar_t RegKeyLxss[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Lxss"; static constexpr wchar_t RegKeyDistroName[] = L"DistributionName"; +static constexpr wchar_t RegKeyModern[] = L"Modern"; using namespace ::Microsoft::Terminal::Settings::Model; using namespace winrt::Microsoft::Terminal::Settings::Model; @@ -188,6 +189,12 @@ static bool getWslNames(const wil::unique_hkey& wslRootKey, continue; } + const auto modernValue{ wil::reg::try_get_value(distroKey.get(), RegKeyModern) }; + if (modernValue.value_or(0u) == 1u) + { + continue; + } + std::wstring buffer; auto result = wil::AdaptFixedSizeToAllocatedResult(buffer, [&](PWSTR value, size_t valueLength, size_t* valueLengthNeededWithNull) -> HRESULT { auto length = gsl::narrow(valueLength * sizeof(wchar_t)); diff --git a/src/cascadia/TerminalSettingsModel/pch.h b/src/cascadia/TerminalSettingsModel/pch.h index 9423b37f91d..452b48a10d8 100644 --- a/src/cascadia/TerminalSettingsModel/pch.h +++ b/src/cascadia/TerminalSettingsModel/pch.h @@ -24,6 +24,7 @@ #endif #include +#include #include #include