Skip to content

devicehost: stop re-signing and fix MSI installer failing to replace wsldevicehost.dll#40075

Open
benhillis wants to merge 4 commits intomasterfrom
user/benhill/wsldevicehost_stop_install
Open

devicehost: stop re-signing and fix MSI installer failing to replace wsldevicehost.dll#40075
benhillis wants to merge 4 commits intomasterfrom
user/benhill/wsldevicehost_stop_install

Conversation

@benhillis
Copy link
Copy Markdown
Member

@benhillis benhillis commented Apr 2, 2026

This change accomplishes two things:

  • Use the real signature on the wsldevicehost.dll binary (it's already signed so re-signing is pointless)
  • Fix potential issue where an in-use wsldevicehost.dll could prevent the new version from being deployed until after reboot. This is because the devicehost dll is loaded into a dllhost.exe process that is not part of the package.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the WSL MSI packaging/install flow for wsldevicehost.dll by (1) consuming the already-signed DeviceHost binary directly (avoiding redundant re-signing) and (2) adding a new MSI custom action to terminate any processes locking wsldevicehost.dll so upgrades can overwrite it without requiring a reboot.

Changes:

  • Add a StopDeviceHostSurrogate custom action (using Restart Manager) and wire it into the MSI execute sequence before InstallFiles.
  • Update MSI packaging to source wsldevicehost.dll directly from the DeviceHost package output path rather than from the generic package input staging.
  • Update build/pipeline wiring to stop staging/publishing wsldevicehost.dll as a separately re-signed artifact, and bump the DeviceHost NuGet to 1.2.10-0.

Reviewed changes

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

Show a summary per file
File Description
src/windows/wslinstall/wslinstall.def Exports the new StopDeviceHostSurrogate entry point from wslinstall.dll.
src/windows/wslinstall/DllMain.cpp Implements StopDeviceHostSurrogate using Restart Manager to shut down processes locking wsldevicehost.dll.
src/windows/wslinstall/CMakeLists.txt Links wslinstall against rstrtmgr.lib for Restart Manager APIs.
packages.config Updates Microsoft.WSL.DeviceHost dependency to 1.2.10-0.
msipackage/package.wix.in Moves wsldevicehost.dll file source to DeviceHost output and adds/schedules the new custom action before InstallFiles.
CMakeLists.txt Removes creation of a build-stage link for wsldevicehost.dll into the staging bin directory (supports “stop re-signing”).
.pipelines/build-stage.yml Removes wsldevicehost.dll from the published artifact pattern list for the main build target set.

Copilot AI review requested due to automatic review settings April 2, 2026 18:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 4 out of 4 changed files in this pull request and generated 2 comments.

* Release COM DLLs before installer test MSI operations

Add PrepareForMsiOperation() that calls CoFreeUnusedLibrariesEx(0)
before each msiexec invocation. This releases in-process COM DLLs
like wslserviceproxystub.dll loaded by prior test classes, preventing
the Restart Manager from detecting the test process as holding file
locks and failing the install on older Server SKUs like ni_release.

* fix CoFreeUnusedLibrariesEx

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
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