HLE: clear blocked DNS lookup results #1474

Closed
ToxicmaggotRP wants to merge 2 commits from upstream-pr/1475 into main
ToxicmaggotRP commented 2026-11-24 18:18:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ToxicmaggotRP on 2026-11-24T18:18:06Z.


Summary

When VIctory blocks a DNS lookup for a non-loopback host, the four Winsock wrappers returned WSAHOST_NOT_FOUND but left the caller's *result unchanged. A caller that reused a result variable could therefore retain a stale pointer after a failed lookup.

Changes

  • Clear the result pointer on blocked getaddrinfo, GetAddrInfoW, GetAddrInfoExA, and GetAddrInfoExW calls.
  • Add a regression test that passes a sentinel pointer through each wrapper and checks both the error code and null output.

This follows the API-compatibility practice illustrated by XCL's native API comparison for RegisterClassExA; this patch is an independent VIctory implementation and contains no copied XCL code. Refs #1242 (VIC-BT-023).

Validation

  • cargo test --locked -p victory-hle — 95 passed; integration test 1 passed.
  • rustfmt --edition 2024 --check crates/victory-hle/src/modules/net.rs — passed.
  • git diff --check — passed.
  • Workspace-wide cargo fmt --all -- --check reports existing formatting differences in untouched files.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6588488508 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1475). Originally posted by [ToxicmaggotRP](https://github.com/ToxicmaggotRP) on 2026-11-24T18:18:06Z. --- ## Summary When VIctory blocks a DNS lookup for a non-loopback host, the four Winsock wrappers returned `WSAHOST_NOT_FOUND` but left the caller's `*result` unchanged. A caller that reused a result variable could therefore retain a stale pointer after a failed lookup. ## Changes - Clear the result pointer on blocked `getaddrinfo`, `GetAddrInfoW`, `GetAddrInfoExA`, and `GetAddrInfoExW` calls. - Add a regression test that passes a sentinel pointer through each wrapper and checks both the error code and null output. This follows the API-compatibility practice illustrated by XCL's [native API comparison for `RegisterClassExA`](https://github.com/xcl-dev/xcl/pull/179); this patch is an independent VIctory implementation and contains no copied XCL code. Refs #1242 (VIC-BT-023). ## Validation - `cargo test --locked -p victory-hle` — 95 passed; integration test 1 passed. - `rustfmt --edition 2024 --check crates/victory-hle/src/modules/net.rs` — passed. - `git diff --check` — passed. - Workspace-wide `cargo fmt --all -- --check` reports existing formatting differences in untouched files.
acetonahard-code commented 2026-11-24 21:28:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T21:10:04Z.


Heads-up: #1411 (opened about half an hour earlier) adds the same helper. A blocked forward lookup clears *result and returns WSAHOST_NOT_FOUND, in the same four wrappers. The two conflict in net.rs.

Tested on Windows 11 with the repo toolchain, merged into current main (ffe310e):

cargo test -p victory-hle passed failed ignored
main 95 0 0
main + this PR 96 0 0
  • The new test passes.
  • cargo clippy --all-targets -- -D warnings, with and without --all-features: clean.

I didn't test with game data.


Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7144566505 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1475#issuecomment-7144566505). Originally posted by [acetonahard-code](https://github.com/acetonahard-code) on 2026-11-24T21:10:04Z. --- Heads-up: #1411 (opened about half an hour earlier) adds the same helper. A blocked forward lookup clears `*result` and returns `WSAHOST_NOT_FOUND`, in the same four wrappers. The two conflict in `net.rs`. Tested on Windows 11 with the repo toolchain, merged into current `main` (ffe310e): | `cargo test -p victory-hle` | passed | failed | ignored | |---|---|---|---| | `main` | 95 | 0 | 0 | | `main` + this PR | 96 | 0 | 0 | - The new test passes. - `cargo clippy --all-targets -- -D warnings`, with and without `--all-features`: clean. I didn't test with game data. --- <sub>Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.</sub>
upstream-sync closed this pull request 2026-11-25 00:05:47 +00:00

Pull request closed

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!1474
No description provided.