[Bug 47832] New: FindFirstFileExW believes every directory entry has been read if NtQueryDirectoryFile underfills buffer

WineHQ Bugzilla wine-bugs at winehq.org
Sat Sep 28 23:47:44 CDT 2019


https://bugs.winehq.org/show_bug.cgi?id=47832

            Bug ID: 47832
           Summary: FindFirstFileExW believes every directory entry has
                    been read if NtQueryDirectoryFile underfills buffer
           Product: Wine
           Version: unspecified
          Hardware: x86
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: kernel32
          Assignee: wine-bugs at winehq.org
          Reporter: qsniyg at mail.com
      Distribution: ---

When using USVFS (through ModOrganizer 2), it will hook NtQueryDirectoryFile,
and its implementation will occasionally underfill the buffer, even if there
are more directory entries to be read.

Due to this check in FindFirstFileExW:

    if (!has_wildcard || info->data_len < info->data_size - max_entry_size)
        {
            ...
            info->data_size = 0;  /* we read everything */
        }

It will stop FindNextFileW from reading more. Windows doesn't seem to exhibit
this behavior.

Removing the `info->data_len < info->data_size - max_entry_size` check allows
it to work properly.

Unfortunately I wasn't able to find any reference to why that check exists. My
best guess after looking through the source code is that it's an optimization,
as the code should still run fine if wine's NtQueryDirectoryFile implementation
underfills the buffer (therefore indicating that there are no more files needed
to be read).

So far I've tested many various applications with the check patched out, with
no obvious regressions.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list