kernelx: implement GetModuleFileNameEx and GetModuleBaseName for mapped images #1174
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1183"
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 Ivankiosan on 2026-11-24T12:56:21Z.
Implements
GetModuleFileNameExW,GetModuleFileNameExA,K32GetModuleFileNameExW,K32GetModuleFileNameExA,GetModuleBaseNameW,GetModuleBaseNameA,K32GetModuleBaseNameW, andK32GetModuleBaseNameAinkernelxso titles, crash reporters, profilers, and diagnostics querying XCL-mapped executables and DLLs get their real file paths and base names rather than failing withERROR_INVALID_HANDLEfrom Windows' native PEB module list.What is in it
GetModuleFileNameExW,GetModuleFileNameExA,K32GetModuleFileNameExW,K32GetModuleFileNameExA,GetModuleBaseNameW,GetModuleBaseNameA,K32GetModuleBaseNameW, andK32GetModuleBaseNameAincrates/xcl/src/hle/kernelx.rsfor XCL's manually-mapped images (the title executable and console/runtime DLLs).psapi.dllthroughkernelxwith fallback to nativepsapi.dllincrates/xcl/src/hle/mod.rs.process == GetCurrentProcess()orGetProcessId(process) == GetCurrentProcessId()):hModule == 0(orm.base) to the title executable or mapped image path/basename instead of failing under Windows' native PEB loader list.ERROR_INVALID_PARAMETERand returns0.kernel32.dllorntdll.dll) and cross-process queries to the nativepsapi/kernel32APIs.hle::kernelx::tests::get_module_file_name_ex_and_base_name_answer_for_mapped_imagescovering wide and ANSI variants, current process pseudo-handle and real OpenProcess handle, null/zero-capacity validation, and native module fallback.Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13)/ MSVC 14.51.cargo test --workspace -- --test-threads=4: all 699 unit tests passed, all integration tests passed, 0 failures across the workspace.cargo test -p xcl --lib get_module_file_name_ex_and_base_name_answer_for_mapped_images: 1 passed, 0 failed.target/release/xcl.exe(cargo build --release -p xcl).Regression run
main:
text xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 7600 title: 419239bf seconds: 10 exit: 0x0 frames shown: 26 (PresentX 26) presents per 2 s (last 3): 0 0 23 device removals: 0 crashes: 0 peak commit: 8172 MBPR head:
text xcl-smoke v1 commit: a72a430471aecaae37bdb710d08986f701756d78 gpu: AMD Radeon RX 7600 title: 419239bf seconds: 10 exit: 0x0 frames shown: 26 (PresentX 26) presents per 2 s (last 3): 0 0 23 device removals: 0 crashes: 0 peak commit: 8366 MBNot tested
AI use
kernelx.rsandmod.rs, implemented theGetModuleFileNameExandGetModuleBaseNamefunctions and unit tests, verified workspace tests and executed the local GPU smoke regression.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:13:39Z.
Independent verification on current
main384f7f7(branch already contains it — clean).Machine: Windows 11, Ryzen 9 7900X; Rust stable MSVC, debug.
cargo test -p xcl --lib module_file: 1 passed, 0 failed —get_module_file_name_ex_and_base_name_answer_for_mapped_imagescovers the new GetModuleFileNameEx/GetModuleBaseName implementation;cargo test -p xcl --lib module: 6 passed overall.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T14:34:53Z.
A run on Linux under Wine.
Tested
x86_64-pc-windows-gnu.a72a430as it is (based on47efa2e), no uncommitted changes. The lib test binary runs under Wine, one test per process (--exact).GetModuleFileNameEx/GetModuleBaseNamefor host modules come from Wine here.hle::kernelx::tests::get_module_file_name_ex_and_base_name_answer_for_mapped_images: ok, no SKIPPED.Not tested
AI use
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-27T21:26:40Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:01:32Z.
Triage (#1607) – head
a72a430No open or merged PR adds GetModuleFileNameEx / GetModuleBaseName, and main has neither. Calls for this process answer from XCL's mapped modules; other handles and processes fall through to the system psapi, and adding
psapi.dllto kernelx's fallback list keeps the rest of psapi resolving.No problems found in the diff. The branch conflicts with main.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.