There is a way to read the directory in just 2-3 kernel calls. (A
little more if the directory is bigger, and provided buffer is not
enough). I can't tell whether it's faster, but it's out there.
fileinfo.c:
https://gist.github.com/1487388
FYI: It's doing more that it's supposed to do, for example two times
calling
if(!GetFileInformationByHandleEx(h, (FILE_INFO_BY_HANDLE_CLASS)i,
buffer1, sizeof(buffer1))
|| !GetFileInformationByHandleEx(h, (FILE_INFO_BY_HANDLE_CLASS)i,
buffer2, sizeof(buffer2)))
continue;
but this was just to explore how the functions were behaving, and
whether they were filling the buffer to the end.
Only one call is needed there.