VFS: FindFirstFileExW with FindExSearchLimitToDirectories is listed too #63

Merged
gefydev merged 1 commit from upstream-pr/64 into main 2026-11-23 10:20:31 +00:00
gefydev commented 2026-11-22 23:15:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gefydev on 2026-11-22T23:15:38Z.


hk_find_first_ex_w virtualises only fSearchOp == FindExSearchNameMatch and passes anything else to Windows unchanged. With FindExSearchLimitToDirectories, a search on a console path (G:\data\*) therefore reaches the PC as G:\data\* and finds nothing.

That op is only a hint: the FindFirstFileExW documentation says that when the file system doesn't support directory filtering, the flag is ignored and files are returned too, and callers have to check FILE_ATTRIBUTE_DIRECTORY themselves. So the VFS can list it like a name match. Ops above 1 (FindExSearchLimitToDevices) still pass through.

Validation

The hooks are process-wide and need an initialized VFS (a global OnceLock), so this isn't a unit test. I ran a probe alone, with a VFS that mounts G: on a temp game folder holding data\f.txt and data\sub\, and the real hooks installed. Under Wine:

FindFirstFileExW(G:\data\*, FindExInfoBasic, …) main this branch
FindExSearchNameMatch . .. f.txt sub . .. f.txt sub
FindExSearchLimitToDirectories nothing (fails) . .. f.txt sub

cargo test -p xcl --lib: 343 passed, 0 failed, on Windows GNU under Wine.

<!-- greyfinch-sync:ivall/xcl:issue:6549091142 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/64). Originally posted by [gefydev](https://github.com/gefydev) on 2026-11-22T23:15:38Z. --- `hk_find_first_ex_w` virtualises only `fSearchOp == FindExSearchNameMatch` and passes anything else to Windows unchanged. With `FindExSearchLimitToDirectories`, a search on a console path (`G:\data\*`) therefore reaches the PC as `G:\data\*` and finds nothing. That op is only a hint: the `FindFirstFileExW` documentation says that when the file system doesn't support directory filtering, the flag is ignored and files are returned too, and callers have to check `FILE_ATTRIBUTE_DIRECTORY` themselves. So the VFS can list it like a name match. Ops above 1 (`FindExSearchLimitToDevices`) still pass through. ## Validation The hooks are process-wide and need an initialized VFS (a global `OnceLock`), so this isn't a unit test. I ran a probe alone, with a VFS that mounts `G:` on a temp game folder holding `data\f.txt` and `data\sub\`, and the real hooks installed. Under Wine: | `FindFirstFileExW(G:\data\*, FindExInfoBasic, …)` | `main` | this branch | |---|---|---| | `FindExSearchNameMatch` | `. .. f.txt sub` | `. .. f.txt sub` | | `FindExSearchLimitToDirectories` | nothing (fails) | `. .. f.txt sub` | `cargo test -p xcl --lib`: 343 passed, 0 failed, on Windows GNU under Wine.
upstream-sync closed this pull request 2026-11-24 06:56:59 +00:00
ivall commented 2026-11-24 07:00:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T10:20:57Z.


Merged (3fa4203). Checked on Windows itself with the real hooks and a VFS mounting G:: FindFirstFileExW(G:\data\*) gives . .. f.txt sub with both FindExSearchNameMatch and FindExSearchLimitToDirectories. Tested on Windows 11 with an RX 9070: cargo test --workspace green with the retail samples (shader pack, console DLLs, texture archive), and Unicorn Overlord reaches its title screen with everything from this round merged. Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7097812492 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/64#issuecomment-7097812492). Originally posted by [ivall](https://github.com/ivall) on 2026-11-23T10:20:57Z. --- Merged (3fa4203). Checked on Windows itself with the real hooks and a VFS mounting `G:`: `FindFirstFileExW(G:\data\*)` gives `. .. f.txt sub` with both `FindExSearchNameMatch` and `FindExSearchLimitToDirectories`. Tested on Windows 11 with an RX 9070: `cargo test --workspace` green with the retail samples (shader pack, console DLLs, texture archive), and Unicorn Overlord reaches its title screen with everything from this round merged. Thanks!
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
xcl-dev/xcl!63
No description provided.