I'm noticing a problem that has crept up a few times over the years, and seems to be happening a lot under Windows 7 in our current build.
When I test for the existence of a file, using ::GetFileAttributes(filename), I am often getting back INVALID_FILE_ATTRIBUTES, and GetLastError() is ERROR_PATH_NOT_FOUND (3).
However, the file does exist, the path exists, the volume exists - its H:\Foo\Bar - which is a folder on a network share that is mapped on my machine to H:.
If I open a command window, it can see it. If I use Windows Explorer to navigate to that folder, it can see it.
If I do those before running our app, we can see it.
But if I run our app first, after a reboot, before anything has attempted to view H:\, then I get the above error repeatedly.
It has always seemed to me that Windows is "helping" me by returning ERROR_PATH_NOT_FOUND immediately when the given share-mapping hasn't been reconnected this session (it is set to auto-reconnect). This is, needless to say, annoying. Is there another API call I could be making to "determine if file/folder X exists?"