From f3d0378c8049fea14a2ea2952da29c6a80095dbb Mon Sep 17 00:00:00 2001 From: rgvxsthi <65727207+rgvxsthi@users.noreply.github.com> Date: Wed, 18 Nov 2026 13:11:53 +1100 Subject: [PATCH] fix(libc): treat directories as case-insensitive when the host cannot report case sensitivity CaseInsensitiveDirectoryWindows treated any failure of the FileCaseSensitiveInfo query as a case-sensitive directory. Hosts that cannot answer it look names up case-insensitively; Wine fails the query with ERROR_CALL_NOT_IMPLEMENTED. MatchNames then listed the whole directory for every lookup of a missing name instead of one FindFirstFileExW for that name. The errors a host gives for an unsupported information class now mean case-insensitive; other failures keep the previous behaviour. --- core/libs/prx/libc/src/General.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/libs/prx/libc/src/General.cpp b/core/libs/prx/libc/src/General.cpp index efad77de4290..288c6e2714e6 100644 --- a/core/libs/prx/libc/src/General.cpp +++ b/core/libs/prx/libc/src/General.cpp @@ -174,8 +174,11 @@ bool CaseInsensitiveDirectoryWindows(const std::filesystem::path& directory) { const std::unique_ptr owner(handle, &CloseHandle); struct { ULONG flags; } information{}; constexpr auto caseSensitiveInfo = static_cast(23); - return GetFileInformationByHandleEx(handle, caseSensitiveInfo, &information, sizeof(information)) && - (information.flags & FILE_CS_FLAG_CASE_SENSITIVE_DIR) == 0; + if (GetFileInformationByHandleEx(handle, caseSensitiveInfo, &information, sizeof(information))) + return (information.flags & FILE_CS_FLAG_CASE_SENSITIVE_DIR) == 0; + const auto error = GetLastError(); + return error == ERROR_CALL_NOT_IMPLEMENTED || error == ERROR_INVALID_PARAMETER || error == ERROR_NOT_SUPPORTED || + error == ERROR_INVALID_FUNCTION; } std::error_code MatchNamesWindows(const std::filesystem::path& directory, std::span names) {