I use FindFirstFile and FindNextFile to get a dirs contents, and for the files I want the file size, good that the WIN32_FIND_DATA struct has nFileSizeLow (and nFileSizeHigh) I thought so I tried to read the nFileSizeLow, but as I've discovered it's always null. In the win32.hlp under FindFirstFile I find "This function searches for files by name only; it cannot be used for attribute-based searches.", doest hat mean that it doesn't get the file size either, thus file size is considered an attribute?
Must I call the GetFileSize to get the files size, and why is there a nFileSizeLow if it's always 0?
Posted on 2003-04-06 07:33:29 by scientica
nFileSizeLow works well for me. So you probably have another bug in your code. You could check: is the structure dword aligned before passing to the function? is the structure defined right (check the offset of nFileSizeLow with your debugger, should be 32)? Dirs will have no filesize!
Posted on 2003-04-06 07:52:40 by beaster
Ok, I doublechecked my debug output, and you're right, I got another bug somewhere, nFileSize does contain a value for a file (more correct all the files), and it's correct.
Thanks for helping me.

btw, is it of some importance that the struct is dword aligned, besides speed?
Posted on 2003-04-06 08:02:03 by scientica
I had some wired errors using unaligned structures, especially with NT and file related functions, so I have always this hint in my "hint-repository" :)
Posted on 2003-04-06 09:48:20 by beaster
Well, WinNT need esp to be dword align, if not you get GPF.
Posted on 2003-04-06 12:29:45 by roticv