mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-12 00:07:24 -06:00
wsl: skip distributions that indicate they are "Modern" (#18183)
This commit is contained in:
parent
772f546ac4
commit
00ff803ace
@ -19,6 +19,7 @@ static constexpr std::wstring_view RancherDistributionPrefix{ L"rancher-desktop"
|
|||||||
// ⌞ DistributionName: {the name}
|
// ⌞ DistributionName: {the name}
|
||||||
static constexpr wchar_t RegKeyLxss[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Lxss";
|
static constexpr wchar_t RegKeyLxss[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Lxss";
|
||||||
static constexpr wchar_t RegKeyDistroName[] = L"DistributionName";
|
static constexpr wchar_t RegKeyDistroName[] = L"DistributionName";
|
||||||
|
static constexpr wchar_t RegKeyModern[] = L"Modern";
|
||||||
|
|
||||||
using namespace ::Microsoft::Terminal::Settings::Model;
|
using namespace ::Microsoft::Terminal::Settings::Model;
|
||||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||||
@ -188,6 +189,12 @@ static bool getWslNames(const wil::unique_hkey& wslRootKey,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto modernValue{ wil::reg::try_get_value<uint32_t>(distroKey.get(), RegKeyModern) };
|
||||||
|
if (modernValue.value_or(0u) == 1u)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
std::wstring buffer;
|
std::wstring buffer;
|
||||||
auto result = wil::AdaptFixedSizeToAllocatedResult<std::wstring, 256>(buffer, [&](PWSTR value, size_t valueLength, size_t* valueLengthNeededWithNull) -> HRESULT {
|
auto result = wil::AdaptFixedSizeToAllocatedResult<std::wstring, 256>(buffer, [&](PWSTR value, size_t valueLength, size_t* valueLengthNeededWithNull) -> HRESULT {
|
||||||
auto length = gsl::narrow<DWORD>(valueLength * sizeof(wchar_t));
|
auto length = gsl::narrow<DWORD>(valueLength * sizeof(wchar_t));
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <wil/cppwinrt.h>
|
#include <wil/cppwinrt.h>
|
||||||
|
#include <wil/registry.h>
|
||||||
|
|
||||||
#include <winrt/Windows.ApplicationModel.AppExtensions.h>
|
#include <winrt/Windows.ApplicationModel.AppExtensions.h>
|
||||||
#include <winrt/Windows.ApplicationModel.h>
|
#include <winrt/Windows.ApplicationModel.h>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user