HLE: WSAConnectByList and GetAddrInfoExA fail where the host lacks them, not abort (Wine) #2247

Open
desplmfao wants to merge 1 commit from upstream-pr/2249 into main
desplmfao commented 2026-11-25 08:49:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T08:49:53Z.


This is commit d469fe9 from @Slaktarn700's proton-fixes branch, carried onto current main (940d32f). Their commit keeps them as author. That branch was never opened upstream; this is the one change from it that main still needs.

Problem

net.rs calls WSAConnectByList and GetAddrInfoExA through host!, and host! panics when the host DLL lacks the export (files.rs). Wine's ws2_32.dll doesn't export these two, so a title calling either one under Wine/Proton ends with "the host lacks ws2_32.dll!…" instead of getting an error back.

Change

Where the host lacks either function, the call now fails cleanly:

  • WSAConnectByList returns failure with WSAEOPNOTSUPP.
  • GetAddrInfoExA takes main's blocked_lookup(result) path, so *result is cleared the same way as for any other blocked lookup.

On Windows hosts that have the exports, nothing changes.

Tested

  • cargo test -p victory-hle net:: (Windows x64, under Proton here): 2 passed. The export check is inside only_loopback_is_reachable.
  • cargo clippy -p victory-hle --all-targets -- -D warnings: clean.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:5488089673 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2249). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T08:49:53Z. --- This is commit `d469fe9` from @Slaktarn700's [`proton-fixes`](https://github.com/Slaktarn700/VIctory/commits/proton-fixes/) branch, carried onto current `main` (`940d32f`). Their commit keeps them as author. That branch was never opened upstream; this is the one change from it that `main` still needs. ## Problem `net.rs` calls `WSAConnectByList` and `GetAddrInfoExA` through `host!`, and `host!` panics when the host DLL lacks the export (`files.rs`). Wine's `ws2_32.dll` doesn't export these two, so a title calling either one under Wine/Proton ends with "the host lacks ws2_32.dll!…" instead of getting an error back. ## Change Where the host lacks either function, the call now fails cleanly: - `WSAConnectByList` returns failure with `WSAEOPNOTSUPP`. - `GetAddrInfoExA` takes `main`'s `blocked_lookup(result)` path, so `*result` is cleared the same way as for any other blocked lookup. On Windows hosts that have the exports, nothing changes. ## Tested - `cargo test -p victory-hle net::` (Windows x64, under Proton here): 2 passed. The export check is inside `only_loopback_is_reachable`. - `cargo clippy -p victory-hle --all-targets -- -D warnings`: clean. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DenRakEiw commented 2026-11-25 09:02:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T09:02:27Z.

Review: APPROVED


Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test -p victory-hle --lib net:: — 2 passed, 0 failed
  • cargo clippy -p victory-hle --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean graceful failure for WSAConnectByList and GetAddrInfoExA on hosts (such as Wine) that lack them instead of aborting. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6054566300 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2249#pullrequestreview-6054566300). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T09:02:27Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test -p victory-hle --lib net::` — 2 passed, 0 failed - `cargo clippy -p victory-hle --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean graceful failure for `WSAConnectByList` and `GetAddrInfoExA` on hosts (such as Wine) that lack them instead of aborting. Looks good. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 09:35:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T09:35:29Z.

Review: COMMENTED


HLE net: WSAConnectByList/GetAddrInfoExA fail cleanly with WSAEOPNOTSUPP when the host ws2_32 lacks them (Wine). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.

<!-- greyfinch-sync:Marvisak/VIctory:review:6055072043 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2249#pullrequestreview-6055072043). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T09:35:29Z. **Review:** COMMENTED --- HLE net: WSAConnectByList/GetAddrInfoExA fail cleanly with WSAEOPNOTSUPP when the host ws2_32 lacks them (Wine). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Marvisak commented 2026-11-25 13:02:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T12:42:53Z.


Automated triage for the maintainers.

Merge candidate. In crates/victory-hle/src/modules/net.rs, WSAConnectByList and GetAddrInfoExA now look up their host function once. Where the host lacks it (Wine's ws2_32), they fail the call instead of the process aborting in host!: WSAEOPNOTSUPP for the connect, and blocked_lookup (name not found) for the lookup.

This does not loosen the offline guards. Both overrides still run their existing checks first (the loopback-only connect check, resolvable), and the new fallback only fails calls. The export test skips these two only when the host lacks them, so Windows still requires them. CI check passes, and the branch merges cleanly.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7162753678 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2249#issuecomment-7162753678). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T12:42:53Z. --- <!-- victory-triage v1 head=3cd19eb6311805c491814aacedc63b740b0d1247 verdict=merge-candidate at=2026-11-25T12:45:00Z --> Automated triage for the maintainers. **Merge candidate.** In `crates/victory-hle/src/modules/net.rs`, `WSAConnectByList` and `GetAddrInfoExA` now look up their host function once. Where the host lacks it (Wine's `ws2_32`), they fail the call instead of the process aborting in `host!`: `WSAEOPNOTSUPP` for the connect, and `blocked_lookup` (name not found) for the lookup. This does not loosen the offline guards. Both overrides still run their existing checks first (the loopback-only connect check, `resolvable`), and the new fallback only fails calls. The export test skips these two only when the host lacks them, so Windows still requires them. CI `check` passes, and the branch merges cleanly. --- _Generated by [Claude Code](https://claude.ai/code)_
ntgata1-dotcom commented 2026-11-25 14:07:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ntgata1-dotcom on 2026-11-25T13:19:24Z.


Wine 11.22: the export test passes, and both fallbacks work as described

Arch Linux, system Wine 11.22, at 3cd19eb. cargo xwin test --locked --no-fail-fast --target x86_64-pc-windows-msvc -p victory-hle --lib, runner wine. Wine 11.22's ws2_32.dll exports WSAConnectByNameA and GetAddrInfoExW, but not WSAConnectByList or GetAddrInfoExA.

victory-hle under Wine passed failed
main 940d32f 141 2
this PR 142 1
  • only_loopback_is_reachable passes. On main it fails at ws2_32.dll lacks WSAConnectByList. The one left is xgamesave::tests::a_kept_blob_past_the_link_limit_is_copied, which also fails on main (the temp folder isn't NTFS here).
  • No test reaches the new fallbacks: blocked_name_lookups_clear_the_result uses a blocked name, which is refused before them, and nothing calls WSAConnectByList. So I called both from a temporary local test (not part of this PR), the way a title would:
    • WSAConnectByList with one loopback address returns 0, and WSAGetLastError gives 10045 (WSAEOPNOTSUPP). On main the same call panics with the host lacks ws2_32.dll!WSAConnectByList.
    • GetAddrInfoExA("localhost") returns 11001 (WSAHOST_NOT_FOUND) and clears the result.

Not run: Windows.

AI-assisted (Claude Code); numbers from my own runs.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163609707 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2249#issuecomment-7163609707). Originally posted by [ntgata1-dotcom](https://github.com/ntgata1-dotcom) on 2026-11-25T13:19:24Z. --- **Wine 11.22: the export test passes, and both fallbacks work as described** Arch Linux, system Wine 11.22, at `3cd19eb`. `cargo xwin test --locked --no-fail-fast --target x86_64-pc-windows-msvc -p victory-hle --lib`, runner `wine`. Wine 11.22's `ws2_32.dll` exports `WSAConnectByNameA` and `GetAddrInfoExW`, but not `WSAConnectByList` or `GetAddrInfoExA`. | `victory-hle` under Wine | passed | failed | |---|---|---| | `main` `940d32f` | 141 | 2 | | this PR | 142 | 1 | - `only_loopback_is_reachable` passes. On `main` it fails at `ws2_32.dll lacks WSAConnectByList`. The one left is `xgamesave::tests::a_kept_blob_past_the_link_limit_is_copied`, which also fails on `main` (the temp folder isn't NTFS here). - No test reaches the new fallbacks: `blocked_name_lookups_clear_the_result` uses a blocked name, which is refused before them, and nothing calls `WSAConnectByList`. So I called both from a temporary local test (not part of this PR), the way a title would: - `WSAConnectByList` with one loopback address returns 0, and `WSAGetLastError` gives 10045 (`WSAEOPNOTSUPP`). On `main` the same call panics with `the host lacks ws2_32.dll!WSAConnectByList`. - `GetAddrInfoExA("localhost")` returns 11001 (`WSAHOST_NOT_FOUND`) and clears the result. Not run: Windows. AI-assisted (Claude Code); numbers from my own runs.
fuzeofficlal commented 2026-11-26 01:04:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:55:23Z.


Code review and Windows 11 verification at head 3cd19eb63118 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-hle/src/modules/net.rs:323-346, 612-635, 1153):
    • WSAConnectByList caches host::function("ws2_32.dll", "WSAConnectByList") in OnceLock<Option<usize>>, setting WSAEOPNOTSUPP (10045) and returning 0 when absent (e.g. Wine) while forwarding directly on Windows 11 with zero per-call lookup overhead.
    • GetAddrInfoExA follows the same cached lookup pattern, calling blocked_lookup(result) (writing null_mut() when non-null and returning WSAHOST_NOT_FOUND = 11001) if absent, and host_has_all_forwarded_exports cleanly excludes both symbols in MISSING_ON_WINE.
  • Verified (Windows 11, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy -p victory-hle --all-targets -- -D warnings: 0 warnings
    • cargo test --locked -p victory-hle --lib -- net::: 2/2 passed.

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179248837 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2249#issuecomment-7179248837). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T00:55:23Z. --- Code review and Windows 11 verification at head `3cd19eb63118` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-hle/src/modules/net.rs:323-346, 612-635, 1153`)**: - `WSAConnectByList` caches `host::function("ws2_32.dll", "WSAConnectByList")` in `OnceLock<Option<usize>>`, setting `WSAEOPNOTSUPP` (`10045`) and returning `0` when absent (e.g. Wine) while forwarding directly on Windows 11 with zero per-call lookup overhead. - `GetAddrInfoExA` follows the same cached lookup pattern, calling `blocked_lookup(result)` (writing `null_mut()` when non-null and returning `WSAHOST_NOT_FOUND = 11001`) if absent, and `host_has_all_forwarded_exports` cleanly excludes both symbols in `MISSING_ON_WINE`. - **Verified (Windows 11, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy -p victory-hle --all-targets -- -D warnings`: 0 warnings - `cargo test --locked -p victory-hle --lib -- net::`: **2/2 passed**. LGTM.
fuzeofficlal commented 2026-11-27 02:58:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T02:58:06Z.

Review: APPROVED


Reviewed at 3cd19eb6311805c491814aacedc63b740b0d1247 — APPROVE.

Verification

  • rustfmt --edition 2024 --check, cargo xtask policy (191 files ok), and all four cargo clippy -p victory-hle targets (--lib, --tests, --all-targets, --all-features with -D warnings) passed cleanly.
  • Verified WSAConnectByList (8 args, extern "system" fn(...) -> i32, returning 0 / FALSE with WSAEOPNOTSUPP 10045) and GetAddrInfoExA (10 args, extern "system" fn(...) -> i32, clearing *result and returning WSAHOST_NOT_FOUND via blocked_lookup) match Win32 ABI and retain standard Windows forwarding when crate::host::function resolves the exports.
  • Passed cargo test -p victory-hle --lib modules::net (2/2).

Non-blocking notes

  • GetAddrInfoExA's fallback path (crates/victory-hle/src/modules/net.rs:629) returns WSAHOST_NOT_FOUND and zeroes *result via blocked_lookup, without calling wsa_error(WSAHOST_NOT_FOUND) to update WSAGetLastError() (which may retain 127 from GetProcAddress or a prior error).
  • Calling host!("ws2_32.dll", "WSASetLastError") inside WSAConnectByList's fallback (net.rs:339) assumes ws2_32.dll itself loaded and exports WSASetLastError (true on Wine, though guarding crate::host::function directly avoids any panic if the DLL ever failed to load).
<!-- greyfinch-sync:Marvisak/VIctory:review:6082891198 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2249#pullrequestreview-6082891198). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-27T02:58:06Z. **Review:** APPROVED --- Reviewed at `3cd19eb6311805c491814aacedc63b740b0d1247` — **APPROVE**. ### Verification - `rustfmt --edition 2024 --check`, `cargo xtask policy` (`191 files ok`), and all four `cargo clippy -p victory-hle` targets (`--lib`, `--tests`, `--all-targets`, `--all-features` with `-D warnings`) passed cleanly. - Verified `WSAConnectByList` (8 args, `extern "system" fn(...) -> i32`, returning `0` / `FALSE` with `WSAEOPNOTSUPP` `10045`) and `GetAddrInfoExA` (10 args, `extern "system" fn(...) -> i32`, clearing `*result` and returning `WSAHOST_NOT_FOUND` via `blocked_lookup`) match Win32 ABI and retain standard Windows forwarding when `crate::host::function` resolves the exports. - Passed `cargo test -p victory-hle --lib modules::net` (2/2). ### Non-blocking notes - `GetAddrInfoExA`'s fallback path (`crates/victory-hle/src/modules/net.rs:629`) returns `WSAHOST_NOT_FOUND` and zeroes `*result` via `blocked_lookup`, without calling `wsa_error(WSAHOST_NOT_FOUND)` to update `WSAGetLastError()` (which may retain `127` from `GetProcAddress` or a prior error). - Calling `host!("ws2_32.dll", "WSASetLastError")` inside `WSAConnectByList`'s fallback (`net.rs:339`) assumes `ws2_32.dll` itself loaded and exports `WSASetLastError` (true on Wine, though guarding `crate::host::function` directly avoids any panic if the DLL ever failed to load).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2249:upstream-pr/2249'
git switch 'upstream-pr/2249'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2249'
git switch 'upstream-pr/2249'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2249'
git switch 'upstream-pr/2249'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2249'
git switch 'main'
git merge --squash 'upstream-pr/2249'
git switch 'main'
git merge --ff-only 'upstream-pr/2249'
git switch 'main'
git merge 'upstream-pr/2249'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2247
No description provided.