HLE: Winsock overrides work when the host lacks newer exports (Wine) #3089
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3091"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-26T07:29:59Z.
Split out of #2973, as asked in its review.
victory-hle's Winsock overrides resolveWSAConnectByListandGetAddrInfoExAfrom the host'sws2_32.dllwhen the module loads. Wine'sws2_32doesn't export them, so loading failed and every test that goes through the overrides failed with it. They are now looked up on first use. When the host has no export, the override refuses the call the way an unreachable network does (WSAENETUNREACHfor the connect, the existing blocked-lookup result for the name lookup).The loopback and
resolvablechecks still run before that fallback, so the offline guards are not loosened: nothing reaches the network that couldn't before.When the host lacks these exports, the call is refused even for loopback targets (
127.0.0.1,localhost): there is nothing to forward it to. On Windows both exports exist, so nothing changes there.Tested (Linux, GE-Proton11-14 Wine, RTX 5090):
victory-hletests undercargo xtask wine-test(#1218), 152 passed, 1 failed. The one failure isxgamesave::tests::a_kept_blob_past_the_link_limit_is_copied, an NTFS hard-link limit that Wine's filesystem doesn't have; #2973 skips it under Wine. I have no Windows machine; on Windows the exports exist, so the overrides behave as before.AI-assisted (Claude); measured on my machine, no game data shared.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T07:49:58Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64:cargo test -p victory-hle net::tests: all tests passed.cargo clippy -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T08:41:59Z.
Review: COMMENTED
Verified
9b872b7alocally on Windows 11 x64:cargo clippy --all-targets --locked -- -D warnings: clean (1.64s).cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed (0.32s).cargo test -p victory-hle --locked: 154 passed, 0 failed (152lib +1fidelityfx +1no_dll_planting,15.51s).rustfmt --edition 2024 --check crates/victory-hle/src/modules/net.rs: clean.The optional lookup fallbacks look sound:
reachable/resolvablepolicy checks still run before theLazyLockexport lookups, and theGetAddrInfoExAmissing-export path setsWSAHOST_NOT_FOUND, clears*resultviablocked_lookup(result), and returns the same error code.One coverage gap worth addressing: the existing
blocked.invalidtest returns before export lookup, andonly_loopback_is_reachabledoes not exerciseWSAConnectByList, so neither new missing-export branch is directly covered by tests. Adding direct tests for the missing-export paths (and noting in the PR description that loopback inputs such as127.0.0.1/localhostare also refused when the host lacks these two exports) would make the fallback behavior verifiable.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T08:19:13Z.
Automated triage for the maintainers.
Merge candidate. In
crates/victory-hle/src/modules/net.rs,WSAConnectByListandGetAddrInfoExAnow look up the host export through an optionalLazyLockand refuse the call (WSAENETUNREACH/blocked_lookup) when the host lacks it, instead of thehost!macro's panic. I checked that the loopback (reachable) andresolvablechecks still run first, so the offline guards are not loosened; on Windows, where both exports exist, behaviour is unchanged. The export test now skips only these named exports when absent.One small correction to the description: on
mainthehost!macro (modules/files.rs) already resolves on first call, not at module load; what fails under Wine is the panic on that call and the export-check test.CI: failing, but in
victory-gpu(frame::tests::waits_end_on_ticks_and_count_frames), which this PR does not touch; a re-run should settle whether it is a flake.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by YaBulochka on 2026-11-26T08:39:40Z.
Tested on Wine: the Winsock fix works, but one test that passes on
mainfails deterministically on this branch.Environment: CachyOS kernel 7.3.5, Ryzen 5 9600X, RX 7600 XT, Wine 11.22,
x86_64-pc-windows-gnu,--features diagnostics,cargo test -p victory-hle --test-threads=1through Wine.main63bcca4modules::net::tests::only_loopback_is_reachablemodules::xgamesave::tests::a_kept_blob_past_the_link_limit_is_copiedmodules::xpackage::tests::completed_installation_unregisters_progress_immediatelyIsolated runs,
--exact, three times each:xpackage::completed_installation_unregisters_progress_immediately—main: ok, ok, ok; this branch: FAILED, FAILED, FAILED.net::only_loopback_is_reachable—main: FAILED; this branch: ok.So the lazy lookup does fix the WinSock override on Wine (that test goes from red to green), and the
xgamesavefailure is ours (no NTFS), not yours. Thexpackageone is new and stable:mainpasses it every time, this branch fails it every time.Is that expected from the change — the override module now loading where it used to fail the load, so a path that previously short-circuited now runs — or is it a real coupling to look at before merge? I can run any specific test or add logging if it helps.
No game files or dumps, numbers only.
Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-26T10:01:47Z.
Thanks both.
@fuzeofficlal: I've added direct tests for the missing-export paths (amended, still one commit,
9096166). The two overrides now take the export lookup as a parameter. Production passes the same lazy lookups as before, so the loopback andresolvablechecks still run first. The tests passNone:WSAConnectByListwith a loopback list returnsWSAENETUNREACH;GetAddrInfoExAforlocalhostand127.0.0.1returnsWSAHOST_NOT_FOUND, sets the last error and clears*result;With both fallbacks broken on purpose, exactly the two new tests fail. The description now says that loopback targets are refused too when the exports are missing.
@YaBulochka: I couldn't reproduce the
xpackagefailure.xpackage::tests::completed_installation_unregisters_progress_immediatelypassed every time, onmainand on this branch: with and withoutdiagnostics, run on its own and in the full suite, three runs each (24 runs). That's Wine 11.22 with thex86_64-pc-windows-msvctarget on an RTX 5090. I don't have the gnu target installed. The change is confined tonet.rs: the new lazy lookups only run inside the two overrides, and that test only touches xpackage's own table, so I don't see a path from this PR to it. Could you post the assertion message and line from your gnu run? That should show whether it's toolchain-specific.AI-assisted (Claude); measured on my machine, no game data shared.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T11:53:14Z.
Review: APPROVED
Reviewed
9096166band verified on Windows 11:reachable/resolvablechecks still execute before the optionalLazyLockexport lookups (crates/victory-hle/src/modules/net.rs:299-379, 630-709), missingWSAConnectByList/GetAddrInfoExAexports fall back toWSAENETUNREACHandWSAHOST_NOT_FOUND(clearing*resultviablocked_lookup), present exports forward as before, and the new injected unit tests cover both missing-export and forwarding paths.rustfmt --edition 2024 --check,xtask policy(191 files ok),cargo clippy -p victory-hle --all-targets -- -D warnings(default and--all-features),modules::net::tests(5/5), and the fullvictory-hletest suite (155 unit + 2 integration tests) all pass.Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-28T01:22:06Z.
Overlap note: while merging all
triage: merge candidatePRs together on one branch, this PR conflicted with #2249 (@desplmfao), which fixes the same Wine case:WSAConnectByListandGetAddrInfoExAmissing from Wine'sws2_32. The two differ only in what the override returns when the export is missing: #2249 returnsWSAEOPNOTSUPP, this PRWSAENETUNREACHthroughconnect()/resolve()helpers. #2249 is older and already a merge candidate, so I'd rather not have two fixes for one problem: unless a reviewer prefers this one, I'll close it in favour of #2249. If the loopback/resolvable-before-fallback ordering this PR tests isn't covered there, I can offer those tests on #2249 instead.AI-assisted (Claude); found during an integration merge, no game data shared.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.