问题描述
我们看到以下问题:
We are seeing the following issue:
方案如下:
1。我们有一个应用程序使用WINAPI函数CreateFile()打开一个文件。
2.使用WINAPI函数WriteFile()不断地写入文件,也就是说,在写入操作之后,我们不使用CloseHandle()关闭文件。
3.我们_highly_依赖的最后修改时间除非我们做"某事",否则不会更新。到文件。 我不确定_exactly_这个"某事"是什么但似乎打开文件会导致上次修改时间更新。
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.
我发现了这个 http://blogs.technet.com/b/asiasupp/archive/2010/ 12/14 / file-date-modified-property-are-not-updating-while-modification-a-file-without-closing-it.aspx。
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.
我很感激,如果您要回答以下编号的问题。
I would appreciate it, if you were to answer the questions numbered below.
1。 " - 在一些但不是全部的情况下,简单的"dir文件名"。足以刷新元数据",在某些情况下,但并非所有情况下,"是什么意思_exactly_ by"? 我们基本上需要保证,因为我们的一位客户深受此影响。
2.是否有操作系统设置强制Windows在每次写入操作时都执行IO。 也就是说,它有OS或文件系统级别设置吗? 这将要求我们对我们的应用程序进行零代码更改 - 所需的解决方案。
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 an OS 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.
到目前为止,我们已经探索了两个途径,并且两者似乎都在最近的修改时间内使用缓存值  a)GetFileInformationByHandle,以及b)C-runtime函数stat(),在st_mtime中读取。
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.
问候,
推荐答案
这会影响数据缓存,从而影响性能。
This will affect data caching and hence performance.
这篇关于问题:文件“修改日期”属性在修改文件而不关闭文件时未更新。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!