Kimi Chen_, hi,
We believe this "bug" is affecting us.
The scenario is as follows:
1. We have an application opening a file using the WINAPI function CreateFile().
2. The file is constantly being written to using the WINAPI function WriteFile(), that is, we do not close the file using CloseHandle() after a write operation.
3. The last modified time, which we _highly_ depend on is not being updated unless we do "something" to the file. I am not sure what _exactly_ this "something" is but it seems that opening the file causes the last modified time to be updated.
I would appreciate it, if you were to answer the questions numbered below.
1. "- in some, but not all, cases a simple "dir filename" is enough to refresh the metadata", what do you mean _exactly_ by "in some, but not all, cases"? We basically need a guarantee because one of our Customers has been deeply affected by this.
2. Is there a setting to force Windows to do an IO every time a write operation is done. That is, it there an OS or file system level setting? This would require us to make zero code changes to our application – the desired solution.
We have explored two avenues so far and both do _not_ seem to be using cached value for the latest modified time. a) GetFileInformationByHandle, and the b) the C-runtime function stat(), reading in the st_mtime.
I found this http://blogs.technet.com/b/asiasupp/archive/2010/12/14/file-date-modified-property-are-not-updating-while-modifying-a-file-without-closing-it.aspx.
- 已移动 Mike Dos ZhangMicrosoft Contingent Staff 2012年5月7日 10:17 not a Windows Desktop dev question, it almost a System known issue as the MSDN blog mentioned (From:General Windows Desktop Development Issues)
After read your description and the link you provided, it seems that it is not a dev API caused issue, it is almost a system issue which issue affect the APIs usage and your product.
So, I think if the system can have a workaround fix this issue, then the API you are using in your product will work for you and your users.
Since it seems that the issue occurred on the Win Server2008 system firstly, so I think maybe that forum can give you some helps.
I also have not found any web site can help you submit a system issue feedback.
MSDN Community Support | Feedback to us