master
h 61 lines 1.89 KB
Raw
1 /*++
2
3 Copyright (c) Microsoft. All rights reserved.
4
5 Module Name:
6
7 WslInstall.h
8
9 Abstract:
10
11 This file contains the definitions for installing WSL distributions
12
13 --*/
14
15 #pragma once
16 #include <string_view>
17 #include "Distribution.h"
18
19 class WslInstall
20 {
21 public:
22 static inline LPCWSTR c_optionalFeatureNameVmp = L"VirtualMachinePlatform";
23 static inline LPCWSTR c_optionalFeatureNameWsl = L"Microsoft-Windows-Subsystem-Linux";
24
25 struct InstallResult
26 {
27 std::wstring Name;
28 std::optional<GUID> Id;
29 std::optional<wsl::windows::common::distribution::TDistribution> Distribution;
30 bool InstalledViaGitHub{};
31 bool Alreadyinstalled{};
32 };
33
34 static HRESULT InstallDistribution(
35 _Out_ InstallResult& installResult,
36 _In_ const std::optional<std::wstring>& distributionName,
37 _In_ const std::optional<ULONG>& version,
38 _In_ bool launchAfterInstall,
39 _In_ bool useGitHub,
40 _In_ bool legacy,
41 _In_ bool fixedVhd,
42 _In_ const std::optional<std::wstring>& localName,
43 _In_ const std::optional<std::wstring>& location,
44 _In_ const std::optional<uint64_t>& vhdSize);
45
46 static std::pair<bool, std::vector<std::wstring>> CheckForMissingOptionalComponents(_In_ bool requireWslOptionalComponent);
47
48 static void InstallOptionalComponents(const std::vector<std::wstring>& components);
49
50 static DWORD InstallOptionalComponent(LPCWSTR component, bool consoleOutput);
51
52 static bool IsOptionalComponentInstalled(LPCWSTR component);
53
54 static std::pair<std::wstring, GUID> InstallModernDistribution(
55 const wsl::windows::common::distribution::ModernDistributionVersion& distribution,
56 const std::optional<ULONG>& version,
57 const std::optional<std::wstring>& name,
58 const std::optional<std::wstring>& location,
59 const std::optional<uint64_t>& vhdSize,
60 const bool fixedVhd);
61 };