libkernel: Windows sceKernelGetdirentries stores 0 in *basep on every read, so guest_directory_entries cannot run on Windows #8590

Closed
opened 2026-10-20 17:40:56 +00:00 by xXPBSXx · 0 comments
xXPBSXx commented 2026-10-20 17:40:56 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T17:40:56Z.


What

On Windows sceKernelGetdirentries (core/libs/prx/libkernel/File/src/Stdio.cpp) writes 0 into *basep before every read. FreeBSD's kern_getdirentries stores the directory offset the read started at (*basep = loff, sys/kern/vfs_syscalls.c, FreeBSD 11.4), so a guest that loops on the cookie sees it advance. core/libs/tests/GuestDirectoryEntries.cpp:81 (base >= 0 && base != previousBase) aborts on Windows at the second read; the test is registered only for non-Windows hosts (if(NOT WIN32) in core/libs/prx/libkernel/CMakeLists.txt), so the gap was never visible in CI.

Repro

Windows 10 (10.0.19045), WinLibs GCC 15.2.0 Release: enable guest_directory_entries (Windows PATH + configure_windows_unwind like guest_directory_rewind), build guest_directory_entry_tests, ctest -R ^guest_directory_entries$: Directory entry check failed at line 81, exit 0xc0000409 (3 of 3 runs).

Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/getdirentries-basep-windows
AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5946578424 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8590). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-20T17:40:56Z. --- ### What On Windows `sceKernelGetdirentries` (`core/libs/prx/libkernel/File/src/Stdio.cpp`) writes `0` into `*basep` before every read. FreeBSD's `kern_getdirentries` stores the directory offset the read started at (`*basep = loff`, `sys/kern/vfs_syscalls.c`, FreeBSD 11.4), so a guest that loops on the cookie sees it advance. `core/libs/tests/GuestDirectoryEntries.cpp:81` (`base >= 0 && base != previousBase`) aborts on Windows at the second read; the test is registered only for non-Windows hosts (`if(NOT WIN32)` in `core/libs/prx/libkernel/CMakeLists.txt`), so the gap was never visible in CI. ### Repro Windows 10 (10.0.19045), WinLibs GCC 15.2.0 Release: enable `guest_directory_entries` (Windows `PATH` + `configure_windows_unwind` like `guest_directory_rewind`), build `guest_directory_entry_tests`, `ctest -R ^guest_directory_entries$`: `Directory entry check failed at line 81`, exit 0xc0000409 (3 of 3 runs). Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/getdirentries-basep-windows AI-assisted (Claude Code).
Sign in to join this conversation.
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
boykopovar/AnyPS5#8590
No description provided.