VFS: hook FindFirstFileExA, which Windows does not send to the W hooks #1254
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1264"
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 ivall/xcl. Originally posted by emirduran707 on 2026-11-24T13:59:05Z.
FindFirstFileExAwas not hooked, and on Windows it does not go through the hooks that are:kernel32!FindFirstFileExAjumps to its ownkernelbaseexport, and that reaches neitherFindFirstFileExWnorFindFirstFileA. Measured on Windows 11 26300 by replacing each of those with a stub that fails:FindFirstFileExA("C:\Windows\*")still listed the folder, while a stub onkernelbase!FindFirstFileExAitself stopped it. #59 noted thatFindFirstFileExAworks through the W hooks; that was measured under Wine, where it holds.So a title's
FindFirstFileExA("G:\data\*", …)went straight to Windows. With noG:on the PC it failed withERROR_PATH_NOT_FOUND; with a PC drive of that letter it listed the PC's folder; and a real path into the game folder listed the original files, without the overlay's files and with deleted ones still there.hk_find_first_ex_ahandles it likehk_find_first_a: the same info levels and search ops as the W hook go to the merged listing (find_first_vfs, then converted toWIN32_FIND_DATAA), and the rest pass through.FindNextFileAandFindClosealready handle the merged handle.What is in it
crates/xcl/src/vfs_hooks.rs: the hook and its entry in the kernelbase list.crates/xcl/tests/vfs_find_ansi.rs(new; an integration test, since the hooks act through the global VFS): a game folder with two files, an overlay with a third and a deletion of one original. ListingG:\data\*withFindFirstFileExA/FindNextFileA/FindCloseat info levels 0 and 1 must give exactly the merged names.Tested
cargo test --workspace -- --test-threads=4on3755c18: 742 passed, 0 failed, 41 ignored; no SKIPPED GPU testsFindFirstFileExA("G:\\data\\*", 0) failed: error 3; with it it passesRegression run
main:
this PR:
Not tested
kernelbaseto exportFindFirstFileExA.FindFirstFileExAdirectly; the smoke title's run is a regression check only.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T14:05:33Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:Thanks!
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-24T14:09:03Z.
Independent native Windows check on
3755c18, Windows 11 build 26300, Rust 1.99.1 MSVC, debug.I extended the synthetic fixture to enumerate the same wildcard through the game folder’s absolute Windows path as well as
G:. With bothFindExInfoStandardandFindExInfoBasic, the PR returnedadded.txtandoriginal.txtfor the absolute path. Restoring the parent hooks returneddeleted.txtandoriginal.txtinstead. A separate unmapped host directory listed correctly in both builds and at both info levels. The stockG:assertions passed on the PR.Synthetic files only. AI-assisted. Codex (GPT-6, exact variant unavailable) extended and ran the scratch fixture and drafted this report.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:40:50Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T13:08:44Z.
Independent desktop NVIDIA verification of PR #1264 at head
3755c18e492f3f1e4bf473a6e1cfcddf3480d46d(1commit; exact parent & merge-base:47efa2ecea0a12934719ae69b81930cf02a4b1c3, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted tests & build (
3755c18e)cargo test --release -p xcl --test vfs_find_ansi -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 0 filtered out× 3 (0.01s,0.00s,0.00s,0skipped; installed32VFS file hooks on Windows 11 and verifiedFindFirstFileExAat info levels0and1returned merged overlay/game files with whiteout suppression)cargo test --release -p xcl --lib -- --nocapture vfs_hooks::(3 consecutive runs)10 passed; 0 failed; 0 ignored; 709 filtered out× 3 (0.01s,0.01s,0.01s,0skipped)cargo build --release -p xcl0.08sincremental after1m 14srelease lib/bin compile duringvfs_find_ansi, exit0,0new warnings invfs_hooks.rs)Paired quiet 60 s retail smoke (
title: 29640639)(Note:
scripts/smoke.ps1at47efa2ecpredates9683e7a6and printed the local folder basename ontitle:; replaced below with the standard9683e7a6title hash29640639, with all measured fields verbatim.)Exact parent & merge-base (
47efa2ecea0a12934719ae69b81930cf02a4b1c3, cached baseline on the same machine):PR #1264 (
3755c18e492f3f1e4bf473a6e1cfcddf3480d46d):Limits of coverage
find_first_file_ex_a_lists_the_merged_game_folder(vfs_find_ansiintegration test installing all32VFS hooks on native Windows 1126200) and the fullvfs_hooks::suite (10/10,0skipped) passed3/3, directly verifyingkernelbase!FindFirstFileExAhooking, overlay merging, and whiteout exclusion atFindExInfoStandard(0) andFindExInfoBasic(1).FindFirstFileExAinfo levels/search ops (lvl > 1 || op > 1) passthrough and title-specific ANSI directory enumeration were not separately probed beyond the 60 s retail smoke (0device removals,0crashes, steady 60 Hz); single-run frame/commit delta vs. the cached parent reflects normal startup variance.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-27T17:58:17Z.
NVIDIA and AMD full-suite run, to go with the reports above by Decodere, since none of them covers AMD. Tested exact head
3755c18e(on its base47efa2e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace --no-fail-fast -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 742 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.find_first_file_ex_a_lists_the_merged_game_folder.XCL_ADAPTER=radeon),cargo test --workspace --no-fail-fast -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 742 passed, 0 failed, 41 ignored, no skips.--skipleaves out tests that fail on main6089122atoo, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-27T18:01:03Z.
Tested on AMD / Linux:
3755c18e(RX 9070 16 GB, RDNA4, Mesa 26.3.1 RADV; Ryzen 5 9600X, 32 GB; CachyOS; Proton Experimentalexperimental-11.0-20261112with vkd3d-proton masterec207194plus a local patch dropping thelpVtblchecks of command allocators and lists; DXC 1.9.2609.5; Rust 1.96.0,x86_64-pc-windows-gnudebug build, tests run under Wine)The head as it is (not merged onto current
main), with its base47efa2ecthe same session as the baseline.Tests (
XCL_REQUIRE_GPU=wave64)cargo test -p xcl --test vfs_find_ansi -- --test-threads=1: 1 passed, 0 failed, 0 ignored (find_first_file_ex_a_lists_the_merged_game_folder).cargo test --workspace --no-fail-fast -- --test-threads=4with--skip compositor_blends_ui_plane_over_scene_plane --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole(the first loses the RADV device here, the other two run out of memory under Wine): lib 693 passed, 5 failed, 21 ignored; base47efa2eclib (same flags): 693 passed, 5 failed, 21 ignored, the same 5. The other binaries fail the same 3 tests as onmainhere (e2e,pls_quota,predication_e2e).vfs_find_ansipassed in this run too.Not tested
AI use
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:30:53Z.
merge-check claim
head:
3755c18e49Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:57:12Z.
merge-check
base:
e429936chead:
3755c18e49merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2127 passed, 9 failed, 48 ignored (26 SKIPPED lines). Note on the base: main at
e429936citself fails 9 tests on this GPU that passed at753e8b1aa few hours earlier (three dispatch_chain tests in gpu::dxil::module::split, gpu_heap_flat_reads_match_guarded_and_root_output, gpu_compute_mode_dispatch_abi, gpu_float_cas_uses_ieee_equality, and three e2e title tests). The same 9 fail with this PR merged, nothing else does; I am finding the merge that introduced them and will post it on #3041. Base alone: 2126 passed, 9 failed, 48 ignored.review: nothing blocking. The hook mirrors the existing wide Ex hook (same info levels and search ops) and the existing ANSI one: path conversion with the ANSI code page as there (it does not follow SetFileApisToOEM, an existing pattern), names limited to the struct's 260 and 14 bytes, merged handles served by the existing next / close hooks, and a guard against handling a call twice when FindFirstFileA goes through the Ex function internally. The test makes and removes only its own uniquely named temp folder.
performance: one more hook on directory enumeration; negligible.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-28T04:59:33Z.
Tested
Exact
3755c18e492f3f1e4bf473a6e1cfcddf3480d46don Windows 11 25H2 x64 build 26200.9974, Ryzen 7 3800X, Rust 1.100.1 MSVC debug. I reran the pinned integration executable from a verified Git archive with a private extension to the test fixture. The runtime source bytes matched the commit. Cargo's build log reported success. The original build monitor did not record Cargo's numeric exit.vfs_find_ansi-5d8ead17d9239cab.exe --exact find_first_file_ex_a_lists_the_merged_game_folder --nocapture --test-threads=1exited 0. 1 passed, 0 failed, 0 ignored, 0 runtime skips.The stock
G:\data\*assertions passed. ForG:\metadata\*.txt,FindFirstFileExAandFindNextFileAreturned exactly the same three entries underFindExInfoStandardandFindExInfoBasic. Those entries werenew.txtat 5 bytes,replace.txtat 19 bytes (4 bytes in the base directory), andretain.txtat 8 bytes. The whiteoutedhidden.txtand nonmatchinglive.binwere excluded.FindClosesucceeded.Not tested
Base revision, release builds, Wine, GPU execution, retail smoke, and the full suite.
AI use
T3 Code through the Codex harness (
gpt-6.2-sol) verified the archive, fixture and executable, reran the synthetic integration check and wrote this report.Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T15:16:47Z.
merge-check claim
head:
3755c18e49Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-29T06:12:30Z.
merge-check
base:
fa204595a4head:
3755c18e49merge: clean
build:
cargo build --offline --locked -j 4 --workspace-> oktests:
cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4-> 2,608 passed, 1 failed, 49 ignored; SKIPPED: 26 notices (21 no wave64, 3 refused per-lane forms, 2 heap-window unavailable); failing:console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, also failed on clean main withDXIL not compiled yet(focused exact control, 0 passed / 1 failed). The PR'svfs_find_ansitest passed.review:
FindFirstFileExAusesfrom_ansi_ptrand returns names throughw_to_awithCP_ACPeven afterSetFileApisToOEM. On this machine (ACP 1252, OEM 437), an isolated syntheticG:\\café\\café*enumeration encoded in OEM bytes failed on the unmodified merged PR with error 3 (0/1); the candidate below passed (1/0), and the stockvfs_find_ansitest still passed (1/0). Microsoft specifies that file APIs switch code pages per process. Separately, the new hook ignoresFindExInfoBasicwhen it collects entries with Standard information, so on volumes with short names it can fillcAlternateFileNamewhere Basic requires an empty string; that second point is source review only.performance: One additional hook on directory enumeration; no per-frame path or title run measured here. The local OEM fix adds a code-page check per converted entry; its cost was not benchmarked.
verdict: not yet: the reproduced OEM path/output regression needs correction, and Basic enumeration needs its documented result semantics.
hardware / tool and model: RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, DXC 1.8.2502.11 / Codex (GPT-6.2 Sol) ran the checks and tested the candidate; Codex (GPT-6.2 Astra) independently reviewed the Win32 contract.
The full-suite count is from the clean local merge before the candidate edits. The OEM probe uses only synthetic files and was run in a separate integration-test process. For the portable regression, derive the OEM bytes from the active code page rather than hard-coding this machine's CP437 value. I did not run a paired title smoke on this merge.
Tested candidate for OEM path and returned-name conversion
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T19:47:15Z.
merge-check
base:
0fe06eb0f0head:
3755c18e49merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2738 passed, 0 failed, 49 ignored, 28 SKIPPED: 22 no wave64, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows (one of them the opt-in XCL_HEAP_WINDOWS=1 test), 1 no GPU_UPLOAD heaps; failing: none. This PR's new test find_first_file_ex_a_lists_the_merged_game_folder ran and passed. The suite ran alone in the queue.
review: none. Whole diff read (vfs_hooks.rs: FindFirstFileExA hooked like FindFirstFileExW: info levels and search ops above 1 pass through, the path through from_ansi_ptr, a VFS listing converted with w_to_a, a VFS error returned with SetLastError; the Guard is held across the pass-through, so a nested hook does not handle it twice; new integration test crates/xcl/tests/vfs_find_ansi.rs, overlay add and whiteout, levels 0 and 1). Re-frozen on this base after main changed vfs_hooks.rs (hk_read_file only, not the hunks here).
performance: no runtime cost of note (one hook, on FindFirstFileExA calls only).
verdict: safe to merge
hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc, debug test profile; trial merge 14e149ff2cafb94b0106d29252b539809b89b325 (local, not pushed). Claude Code: Claude Opus 5.5 (coordination, full-diff review, draft).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:16:59Z.
Triage (#1607) – head
3755c18No open or merged PR hooks
FindFirstFileExA; main hooks only FindFirstFileExW, FindFirstFileW and FindFirstFileA. The hook mirrorshk_find_first_ex_w(same level/op filter) and converts throughw_to_alikehk_find_first_a.No problems found in the diff.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T11:10:33Z.
merge-check
base:
1c8b551475head:
3755c18e49merge: clean (trial-merge commit 5533df640497fd221d318b1c6b49831c630a0b3f, git diff --check clean)
build: cargo build --workspace ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture (44 targets): 2909 passed, 1 failed, 51 ignored (+1 new integration test target vs main baseline 2908/1). Targeted tests/vfs_find_ansi.rs::find_first_file_ex_a_lists_the_merged_game_folder (37 file hooks active) and all 12/12 vfs_hooks::tests passed with 0 skips. The single failure is the pre-existing Issue #3441 flake in tests/gpu_two_pass_cache_e2e.rs::two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (line 584, left: 1, right: 0), reproduced identically on clean base
1c8b5514and unrelated to vfs_hooks.rs. 28 SKIPPED lines (host environment only: 22 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 2 no heap windows, 1 cannot disable the driver cache (Windows Developer Mode required)).review: Read the full merged diff (+90/-0 across crates/xcl/src/vfs_hooks.rs and crates/xcl/tests/vfs_find_ansi.rs). Hooks
FindFirstFileExA(which native Windows does not route throughFindFirstFileExWorFindFirstFileA) by mirroringhk_find_first_ex_w(lvl > 1 || op > 1passthrough,Guard::enter()held across fallback to prevent re-entrant double-handling,find_first_vfs,SetLastErroron error) andhk_find_first_a(from_ansi_ptr+w_to_a). The new integration test installs VFS hooks in a dedicated process and verifies overlay merging and whiteout suppression onG:\data\*at bothFindExInfoStandard(0) andFindExInfoBasic(1), cleaning up its unique temp folder via RAII. Regarding the earlier non-blocking review points: on base1c8b5514,from_ansi_ptr/w_to_a(CP_ACP) is the existing pattern acrosshk_find_first_a,hk_find_next_a,CreateFileA,GetFileAttributesA,GetFileAttributesExA,GetDiskFreeSpaceA, andCopyFileA, andFindExInfoBasicsharingfind_first_vfswithout clearingcAlternateFileNameis the existing pattern inhk_find_first_ex_w(vfs_hooks.rs:1168-1185). Both are worthwhile repo-wide follow-ups rather than regressions blocking this fix. No scope creep or UB.performance: not applicable (Tier 1 — one additional VFS directory-enumeration hook on
FindFirstFileExA, off hot rendering/GPU paths).verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
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.