master
h 51 lines 1.3 KB
Raw
1 /*++
2
3 Copyright (c) Microsoft. All rights reserved.
4
5 Module Name:
6
7 ServiceProcessLauncher.h
8
9 Abstract:
10
11 This file contains the definitions for ServiceProcessLauncher and ServiceRunningProcess.
12
13 --*/
14
15 #pragma once
16 #include "WSLCProcessLauncher.h"
17 #include "WSLCProcess.h"
18
19 namespace wsl::windows::service::wslc {
20
21 class WSLCVirtualMachine;
22
23 class ServiceRunningProcess : public common::RunningWSLCProcess
24 {
25 public:
26 NON_COPYABLE(ServiceRunningProcess);
27 DEFAULT_MOVABLE(ServiceRunningProcess);
28
29 ServiceRunningProcess(const Microsoft::WRL::ComPtr<WSLCProcess>& process, WSLCProcessFlags Flags);
30 common::io::HandleWrapper GetStdHandle(int Index) override;
31 wil::unique_event GetExitEvent() override;
32 WSLCProcess& Get();
33
34 protected:
35 void GetState(WSLCProcessState* State, int* Code) override;
36
37 private:
38 Microsoft::WRL::ComPtr<WSLCProcess> m_process;
39 };
40
41 class ServiceProcessLauncher : public common::WSLCProcessLauncher
42 {
43 public:
44 NON_COPYABLE(ServiceProcessLauncher);
45 NON_MOVABLE(ServiceProcessLauncher);
46 using WSLCProcessLauncher::WSLCProcessLauncher;
47
48 std::tuple<HRESULT, int, std::optional<ServiceRunningProcess>> LaunchNoThrow(WSLCVirtualMachine& virtualMachine);
49 ServiceRunningProcess Launch(WSLCVirtualMachine& virtualMachine);
50 };
51 } // namespace wsl::windows::service::wslc