views:

573

answers:

4

Windows has GetFileTime API which allows getting file time information by open file handle. What I wanted to know is, if it is possible to get this information by file name without opening the file explicitly. And if possible is it also applicable to Windows Mobile platform?

A: 

GetFileTime is available on all versions of Windows CE. You're unlikely to find a way to accomplish this without a valid file handle in Win32.

DannySmurf
+1  A: 
crashmstr
I tried what you suggested before. It works but I was actually looking for something more efficient. Thanks.
Szere Dyeri
+3  A: 

If you call CreateFile with a dwFileAccess value of zero, it "specifies device query access to the object. An application can query device attributes without accessing the device." No clue why they removed that really informative bit of text from newer versions of the documentation, as the implementation in the FSD is still the same.

ctacke
What's FSD? The regular Win32 CreateFile documentation says the same thing about a zero dwFileAccess value. Which version of the documentation was it removed from?
Rob Kennedy
FSD == File System Driver.The CE 6.0 docs have removed the note:http://msdn.microsoft.com/en-us/library/aa914735.aspx
ctacke
Thanks, this was great help!
Szere Dyeri
Maybe they removed the documentation because it may depend on the implementation of the FSD? Great info tho, CreateFile is such a complex api that it's easy to miss something like this.
Shane Powell
@Shane: As with everything in CE, the OEM gets the final say in how stuff works so yes, the FSD could be modified that way. Though it could be modified to not even open a file for that matter. My guess is it was left out by mistake (and I should probably take the time to fix it).
ctacke
A: 

Just a note on using the file times on a WinCE file:

Quote from the MSDN docs on WinCE GetFileTime

The Windows CE object store returns the same time for all three parameters. In general, file system drivers will vary how they support this function.

I found this to be true on all devices I have tried.

Shane Powell
I am able to get different values. This behavior is probably device specific. Thanks for the info though.
Szere Dyeri