[PATCH 2/2] ntdll: Set restart_scan on first call to NtQueryDirectoryFile.
david at l8s.co.uk
Wed Jul 20 12:33:14 CDT 2011
On Wed, Jul 20, 2011 at 07:29:13PM +0200, Alexandre Julliard wrote:
> Grazvydas Ignotas <notasas at gmail.com> writes:
> > Here is another idea:
> > It seems getdents64 is indeed returning "." and "..", but not
> > necessarily first, like Windows does. I think we could swap first 2
> > entries returned, whatever they are, with "." and "..". It would work
> > like this:
> > - read the 2 first entries to advance file pointer, but ignore them,
> > return "." or ".." instead
> > - return other entries normally
> > - after "." or ".." is encountered, save current file offset and seek
> > to first or second entry (respectively) and return that instead. For a
> > corner case where that spot has ".." or ".", return the other one of
> > first 2.
> > - seek back where we were
> > I think this would also fix fake_dot_dot + single_entry case. What do you think?
> That could probably be made to work, yes.
Remember that you can only seek to the offsets returned by the OS.
Directory offsets aren't necessarily byte offsets.
(They may be 64bit values even for small directories.)
David Laight: david at l8s.co.uk
More information about the wine-devel