Loader: run on Windows 10 (clear the IAT directory) #44
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/44"
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 steppergg on 2026-11-23T23:42:59Z.
What
On Windows 10 (19045),
LoadLibraryExWof the prepared image faults with0xC0000005inntdll, reading0xC(an import descriptor'sName).prepareclears the import directory but leaves the IAT directory, and Windows 10's loader still walks it; Windows 11 skips it.This clears the IAT directory together with the import and bound-import directories (
dir::IAT = 12added tovictory-pelayout). Nothing needs it afterwards:bind_importsunprotects and fills each slot itself (windows.rs,VirtualProtectper slot) frominfo.importsparsed from the original.It also skips
WinHttpGetProxySettingsExinnet.rs's "every override names a real export" test. That export only exists in Windows 11'swinhttp.dll; our override serves the title either way.Relation to #28
#28 fixes the same crash by pointing the import directory at the table's all-zero terminator. This is an alternative: it removes what Windows 10 trips on instead of feeding it an empty table, so there is no fallback path when an image has no readable terminator (#28 falls back to zeroing, which is the crashing case). Either is fine by me; happy to close this if #28 is preferred. The
net.rstest fix is independent of either.How the cause was found
I took the prepared image the crashing
load_probetest left behind and loaded copies with one data directory zeroed at a time, each in its own process. Only zeroing the IAT directory loaded; zeroing load config, TLS, relocations, exceptions, debug, exports or delay imports did not.Tested
cargo test --workspacefailedvictory-loader --test load_probe(STATUS_ACCESS_VIOLATIONinsidevictory_loader::load) andonly_loopback_is_reachable.cargo test --workspace --lockedpasses everything, includingloads_binds_and_calls_probeend to end (bind, calls into the image, TLS callbacks andDllMainon new threads, detach).prepare's test now also asserts the IAT directory is cleared.cargo xtask policypasses. Not tested with game data.AI assistance: Claude Code traced the crash, prepared the patch and ran the checks above.
Imported from Marvisak/VIctory. Originally posted by Proudnoob4 on 2026-11-24T00:21:32Z.
Tested
6ca3befon Windows 10 22H2 (19045.6456), i5-13600K, RTX 4080 (driver 621.01). AI-assisted (Claude); I ran all of this myself.cargo test --workspace: all pass (224, 3 ignored). On main97c78d1the same machine failsload_probe(0xC0000005 in ntdll) andnet::only_loopback_is_reachable, so both fixes work as described.victory run(no--execute) maps and binds with 0 missing imports, but never logsstatic TLS redirected. Windows 10 left the exe's TLS index at 0.25a3e95, and its earlierd85097a), the same run logsstatic TLS redirected index=12 patched=53246, and the title then boots (details in #28).load_probecan't catch this, because the probe has no static TLS.So what passed everything here on Windows 10 was #28's layout together with this PR's
net.rschange.Imported from Marvisak/VIctory. Originally posted by noviw-rblx on 2026-11-24T00:44:00Z.
checked: #44 | with: cargo test -p victory-loader | on: Windows 10, Rust 1.98.1, head
6ca3befa, CPU only | result: load_probe 2 passed. IAT directory is cleared alongside import/bound-import. No game data required.Imported from Marvisak/VIctory. Originally posted by Sunkiller-qc on 2026-11-24T01:05:47Z.
Now that #28 is merged, the
prepare.rspart here conflicts with main, and per Proudnoob4's Windows 10 run above it is also the layout that leaves the static TLS index at 0. (I suggested clearing the IAT on #28, but that turned out to be wrong for the same reason.) I think it's best to drop it.The
net.rschange is still useful, though: main'sonly_loopback_is_reachabletest still checksWinHttpGetProxySettingsEx(crates/victory-hle/src/modules/net.rs:1052-1056here), which fails on Windows 10. Could this PR be cut down to just that test change, rebased on main?Static review, not built or run.
Imported from Marvisak/VIctory. Originally posted by Sunkiller-qc on 2026-11-24T01:29:42Z.
Follow-up: #152 now makes just the
net.rstest change (and only skipsWinHttpGetProxySettingsExwhen the host really lacks it). With #28 merged, I think this PR can be closed in favour of #152.Static review, not built or run.
Pull request closed