| 1 | // Copyright (C) Microsoft Corporation. All rights reserved. |
| 2 | |
| 3 | #pragma once |
| 4 | |
| 5 | #include "wslc.h" |
| 6 | #include "PluginManager.h" |
| 7 | #include <wil/resource.h> |
| 8 | #include <vector> |
| 9 | |
| 10 | namespace wsl::windows::service::wslc { |
| 11 | |
| 12 | // |
| 13 | // WSLCPluginNotifier - SYSTEM service implementation of IWSLCPluginNotifier. |
| 14 | // Lives in the SYSTEM service and is passed (via COM marshalling) as a top-level |
| 15 | // parameter to the per-user WSLC session process via IWSLCSessionFactory::CreateSession. |
| 16 | // The per-user process invokes the On* methods, which dispatch to PluginManager. |
| 17 | // |
| 18 | class DECLSPEC_UUID("E29B0F1A-4E18-4F09-83A2-2D6B1B9F8C4D") WSLCPluginNotifier |
| 19 | : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::WinRtClassicComMix>, IWSLCPluginNotifier, IFastRundown> |
| 20 | { |
| 21 | public: |
| 22 | NON_COPYABLE(WSLCPluginNotifier); |
| 23 | NON_MOVABLE(WSLCPluginNotifier); |
| 24 | |
| 25 | WSLCPluginNotifier( |
| 26 | wsl::windows::service::PluginManager& Plugins, |
| 27 | ULONG SessionId, |
| 28 | DWORD CreatorPid, |
| 29 | std::wstring DisplayName, |
| 30 | wil::shared_handle UserToken, |
| 31 | std::vector<BYTE>&& UserSid); |
| 32 | |
| 33 | IFACEMETHOD(OnContainerStarted)(_In_ LPCSTR InspectJson) override; |
| 34 | IFACEMETHOD(OnContainerStopping)(_In_ LPCSTR ContainerId) override; |
| 35 | IFACEMETHOD(OnImageCreated)(_In_ LPCSTR InspectJson) override; |
| 36 | IFACEMETHOD(OnImageDeleted)(_In_ LPCSTR ImageId) override; |
| 37 | IFACEMETHOD(OnVmStarted)() override; |
| 38 | IFACEMETHOD(OnVmStopping)() override; |
| 39 | |
| 40 | private: |
| 41 | wsl::windows::service::PluginManager& m_plugins; |
| 42 | std::wstring m_displayName; |
| 43 | wil::shared_handle m_userToken; |
| 44 | std::vector<BYTE> m_userSid; |
| 45 | WSLCSessionInformation m_sessionInfo{}; |
| 46 | }; |
| 47 | |
| 48 | } // namespace wsl::windows::service::wslc |