Ben, This is fixed in .91. The *only* way I have found to stat c: \pagefile.sys is by using FindFirstFile. Now Factor tries to call CreateFileW and GetFileInformationByHandle, and if that fails, it tries FindFirstFile. This fixed the d:\home vs d:\home\ bug too.
GetInformationByHandle was about 20% slower than FindFirstFile for statting 75k files the time I ran it. (7.40 vs 5.88 seconds) Doug On Nov 21, 2007, at 10:53 AM, Ben de Graaff wrote: > The current implementation of stat on Windows using FindFirstFile > doesn't really work all that great. > > For example: > "D:\\home" stat works > "D:\\home\\" stat doesn't work > > Some Googling revealed the following comment: > >> Use CreateFile() and GetFileInformationByHandle(), rather than >> FindFirstFile() like Microsoft's stat() does, for four reasons: >> (1) CreateFile() does not require "List Folder Contents" >> permission on the parent directory like FindFirstFile() does; >> (2) It works for directories specified with a trailing slash or >> backslash and it works for root (drive or UNC) directories like C: >> and \\SERVER\SHARE, with or without a trailing slash or backslash >> (provided that this is a Windows NT platform and the >> FILE_FLAG_BACKUP_SEMANTICS flag is passed to allow directory >> handles to be obtained), whereas FindFirstFile() requires non-root >> directories to not have a trailing slash or backslash and requires >> root directories to have a trailing \*; and >> (3) The BY_HANDLE_FILE_INFORMATION structure returned by >> GetFileInformationByHandle() contains the number of links to the >> file, which the WIN32_FIND_DATA structure returned by FindFirstFile >> () does not; and most importantly >> (4) The file times in that structure are correct UTC times on both >> NTFS and FAT, whereas on FAT the file times in the WIN32_FIND_DATA >> structure are sometimes wrong w.r.t. DST season changes. > Comment and source code at: > http://search.cpan.org/src/SHAY/Win32-UTCFileTime-1.46/UTCFileTime.xs > > This seems like a much better approach to me. > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk