master
hpp 89 lines 3.11 KB
Raw
1 /*++
2
3 Copyright (c) Microsoft. All rights reserved.
4
5 Module Name:
6
7 hcs.hpp
8
9 Abstract:
10
11 This file contains host compute service helper function declarations.
12
13 --*/
14
15 #pragma once
16 #include "hcs_schema.h"
17 #include "hns_schema.h"
18 #include <ComputeNetwork.h>
19 #include <ComputeCore.h>
20
21 namespace wsl::windows::common::hcs {
22
23 using unique_hcn_endpoint = wil::unique_any<HCN_ENDPOINT, decltype(&HcnCloseEndpoint), HcnCloseEndpoint>;
24
25 using unique_hcn_service_callback = wil::unique_any<HCN_CALLBACK, decltype(&HcnUnregisterServiceCallback), HcnUnregisterServiceCallback>;
26
27 using unique_hcn_guest_network_service_callback =
28 wil::unique_any<HCN_CALLBACK, decltype(&HcnUnregisterGuestNetworkServiceCallback), HcnUnregisterGuestNetworkServiceCallback>;
29
30 using unique_hcn_guest_network_service =
31 wil::unique_any<HCN_GUESTNETWORKSERVICE, decltype(&::HcnCloseGuestNetworkService), ::HcnCloseGuestNetworkService>;
32
33 using unique_hcn_network = wil::unique_any<HCN_NETWORK, decltype(&HcnCloseNetwork), HcnCloseNetwork>;
34
35 using unique_hcs_operation = wil::unique_any<HCS_OPERATION, decltype(&HcsCloseOperation), HcsCloseOperation>;
36
37 using unique_hcs_system = wil::unique_any<HCS_SYSTEM, decltype(&HcsCloseComputeSystem), HcsCloseComputeSystem>;
38
39 void AddPlan9Share(
40 _In_ HCS_SYSTEM ComputeSystem,
41 _In_ PCWSTR Name,
42 _In_ PCWSTR AccessName,
43 _In_ PCWSTR Path,
44 _In_ UINT32 Port,
45 _In_ Plan9ShareFlags Flags,
46 _In_opt_ HANDLE UserToken = nullptr);
47
48 void RemovePlan9Share(_In_ HCS_SYSTEM ComputeSystem, _In_ PCWSTR AccessName, _In_ UINT32 Port);
49
50 void AddVhd(_In_ HCS_SYSTEM ComputeSystem, _In_ PCWSTR VhdPath, _In_ ULONG Lun, _In_ bool ReadOnly = false);
51
52 void AddPassThroughDisk(_In_ HCS_SYSTEM ComputeSystem, _In_ PCWSTR Disk, _In_ ULONG Lun);
53
54 unique_hcs_system CreateComputeSystem(_In_ PCWSTR Id, _In_ PCWSTR Configuration);
55
56 unique_hcs_operation CreateOperation();
57
58 wsl::shared::hns::HNSEndpoint GetEndpointProperties(HCN_ENDPOINT endpoint);
59
60 const std::vector<std::string>& GetProcessorFeatures();
61
62 GUID GetRuntimeId(_In_ HCS_SYSTEM ComputeSystem);
63
64 std::pair<uint32_t, uint32_t> GetSchemaVersion();
65
66 void GrantVmAccess(_In_ PCWSTR VmId, _In_ PCWSTR FilePath);
67
68 void ModifyComputeSystem(_In_ HCS_SYSTEM ComputeSystem, _In_ PCWSTR Configuration, _In_opt_ HANDLE Identity = nullptr);
69
70 unique_hcs_system OpenComputeSystem(_In_ PCWSTR Id, _In_ DWORD RequestedAccess);
71
72 void RegisterCallback(_In_ HCS_SYSTEM ComputeSystem, _In_ HCS_EVENT_CALLBACK Callback, _In_ void* Context);
73
74 void RemoveScsiDisk(_In_ HCS_SYSTEM ComputeSystem, _In_ ULONG Lun);
75
76 void RevokeVmAccess(_In_ PCWSTR VmId, _In_ PCWSTR FilePath);
77
78 void StartComputeSystem(_In_ HCS_SYSTEM ComputeSystem, _In_ LPCWSTR Configuration);
79
80 void TerminateComputeSystem(_In_ HCS_SYSTEM ComputeSystem);
81
82 unique_hcn_service_callback RegisterServiceCallback(_In_ HCS_NOTIFICATION_CALLBACK Callback, _In_ PVOID Context);
83
84 unique_hcn_guest_network_service_callback RegisterGuestNetworkServiceCallback(
85 _In_ const unique_hcn_guest_network_service& GuestNetworkService, _In_ HCS_NOTIFICATION_CALLBACK Callback, _In_ PVOID Context);
86
87 bool IsDisableVgpuSettingsSupported();
88
89 } // namespace wsl::windows::common::hcs