Repository navigation
fix(windows): resolve iphlpapi connectivity-hint exports dynamically (#2043) - #2051
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2043.
Resolves
GetNetworkConnectivityHintandNotifyNetworkConnectivityHintChangefromiphlpapi.dllat runtime instead of importing them at link time, preventing the0xC06D007F(ERROR_PROC_NOT_FOUND) delay-load abort on Windows Server 2019 and Windows 10 1809–1909 (build 17763).Root cause
apps/desktop/src/workspace/lifecycle/launch/network.rsimportedGetNetworkConnectivityHintandNotifyNetworkConnectivityHintChangedirectly fromwindows-sys. Because both exports were added in Windows 10 2004 (build 19041) andiphlpapi.dllis delay-loaded, the MSVC delay-load helper raised0xC06D007Fshortly after the first frame whenon_readycallednetwork::subscribe, before the existingNotifyIpInterfaceChangefallback could run.Changes
iphlpapi.dllwithLoadLibraryExW(..., LOAD_LIBRARY_SEARCH_SYSTEM32)and look upGetNetworkConnectivityHintandNotifyNetworkConnectivityHintChangeviaGetProcAddressinapps/desktop/src/workspace/lifecycle/launch/network.rs.LEVEL, registeringreach_changed, and keepingiphlpapi.dllloaded for the process lifetime).FreeLibraryand fall through cleanly toNotifyIpInterfaceChange(available since Windows Vista).crates/browser-pane/src/background.rs(NetworkInformation::GetInternetConnectionProfile) already handlesErrwithout panicking, and no other Windows 10 2004+ link-time imports exist in the desktop binary.Verification
pwsh scripts/guardrails.ps1: 11/11 passed.cargo check -p opencode-desktop --lib --bins,cargo check -p opencode-desktop-library, andcargo clippy -p opencode-desktop --no-deps --lib --bins: passed with zero warnings innetwork.rs.opencode-desktop-library(opencode_desktop_app.dll) on Windows 11 and parsed its PE32+ import and delay-import tables:iphlpapi.dllis delay-imported with onlyNotifyIpInterfaceChange, and neitherGetNetworkConnectivityHintnorNotifyNetworkConnectivityHintChangeappears in either table.