Skip to content

Use bespoke interfaces to communicate with wsldevicehost - #41099

Merged
Brian Perkins (Brian-Perkins) merged 3 commits into
masterfrom
user/bperkins/wsldevicehost_custom_interface
Jul 17, 2026
Merged

Use bespoke interfaces to communicate with wsldevicehost#41099
Brian Perkins (Brian-Perkins) merged 3 commits into
masterfrom
user/bperkins/wsldevicehost_custom_interface

Conversation

@Brian-Perkins

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Replace inbox interfaces between wsldevicehost and WSL service with custom interfaces. This moves parameter passing from complex string parsing to function calls. The expectation is that even though this is a COM interface, we have no reason to keep backwards compatibility and the interfaces can be modified as needed. The only caveat is that the registration piece is separate from the IDL file, so care must be taken if new interfaces/clsids are added that they are properly registered.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the existing “inbox” string-parsing based communication path between the WSL service and wsldevicehost with bespoke COM interfaces (from the Microsoft.WSL.DeviceHost NuGet), moving configuration and device operations into structured method calls. It also introduces and packages a dedicated proxy/stub DLL to support cross-process COM for these interfaces.

Changes:

  • Add/build/package wsldevicehostproxystub.dll and register its interfaces/CLSID via MSI.
  • Refactor GuestDeviceManager, DeviceHostProxy, and ConsommeNetworking to use typed IWsl* interfaces for virtiofs/virtionet/pmem + swiotlb configuration.
  • Bump Microsoft.WSL.DeviceHost NuGet dependency and adjust build/docs accordingly.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/windows/wsldevicehoststub/WslDeviceHostProxyStub.rc New version/resource metadata for wsldevicehostproxystub.dll.
src/windows/wsldevicehoststub/WslDeviceHostProxyStub.def New exports definition for the proxy/stub DLL entry points.
src/windows/wsldevicehoststub/inc/CMakeLists.txt Adds IDL generation target for WslDeviceHost.idl from the DeviceHost NuGet.
src/windows/wsldevicehoststub/CMakeLists.txt Builds the new proxy/stub DLL from MIDL-generated sources and wires registration CLSID.
src/windows/wslcsession/WSLCVirtualMachine.h Updates comments to reflect new capability forwarding semantics.
src/windows/wslcsession/WSLCVirtualMachine.cpp Updates comments to reflect new device creation timing and responsibility.
src/windows/service/inc/wslc.idl Updates interface comments for guest capabilities → wsldevicehost flow.
src/windows/service/exe/WslCoreVm.h Removes stored swiotlb option string (now configured via devicehost APIs).
src/windows/service/exe/WslCoreVm.cpp Routes virtio device operations through new GuestDeviceManager typed APIs.
src/windows/service/exe/HcsVirtualMachine.h Removes virtiofs CLSID/swiotlb option string; tracks m_swiotlbConfigured.
src/windows/service/exe/HcsVirtualMachine.cpp Updates virtiofs creation/removal + capability application to new APIs.
src/windows/common/GuestDeviceManager.h Replaces generic “AddGuestDevice” with typed virtiofs/net/pmem methods and SetSwiotlb.
src/windows/common/GuestDeviceManager.cpp Implements new typed device APIs and tracks virtionet devices by tag.
src/windows/common/DeviceHostProxy.h Switches to IWsl* interfaces/callbacks; adds typed device creation + swiotlb methods.
src/windows/common/DeviceHostProxy.cpp Implements typed device creation/teardown; adds vm caching and swiotlb configuration.
src/windows/common/ConsommeNetworking.h Removes swiotlb/device-options string plumbing from constructor/state.
src/windows/common/ConsommeNetworking.cpp Replaces virtionet string option parsing with typed config + IWslVirtioNetDevice port binds.
src/windows/common/CMakeLists.txt Adds dependency on wsldevicehostidl for common library builds.
packages.config Bumps Microsoft.WSL.DeviceHost package version.
msipackage/package.wix.in Installs proxy/stub DLL and registers proxy/stub CLSID + interface proxy mappings + new devicehost CLSIDs.
msipackage/CMakeLists.txt Includes wsldevicehostproxystub.dll in MSI binaries/dependencies.
doc/docs/dev-loop.md Clarifies CMAKE_BUILD_TYPE=Release usage with --config Release.
CMakeLists.txt Adds include path for generated DeviceHost headers and adds wsldevicehoststub subdirectories.

Comment thread src/windows/common/DeviceHostProxy.cpp
Comment thread packages.config Outdated
Copilot AI review requested due to automatic review settings July 17, 2026 01:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Comment thread src/windows/common/DeviceHostProxy.cpp
Comment thread src/windows/wsldevicehoststub/CMakeLists.txt Outdated
Copilot AI review requested due to automatic review settings July 17, 2026 16:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.

Comment thread src/windows/common/DeviceHostProxy.cpp
Comment thread src/windows/common/GuestDeviceManager.cpp
Comment thread src/windows/common/DeviceHostProxy.cpp
Comment thread src/windows/common/GuestDeviceManager.h

@benhillis Ben Hillis (benhillis) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is much better than the old string interface stuff, nice job Brian.

@Brian-Perkins
Brian Perkins (Brian-Perkins) merged commit a5b9339 into master Jul 17, 2026
14 checks passed
@Brian-Perkins
Brian Perkins (Brian-Perkins) deleted the user/bperkins/wsldevicehost_custom_interface branch July 17, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants