Question: Is there a way to identify/filter ReadDirectoryChangesW() events from placeholder creation and hydration? #52
Replies: 1 comment
-
I suppose that I should be able to look at the changed file's metadata with FindFileFirstEx and ignore Size, LastWrite, LastAccess, and CreationTime events if it is still a placeholder on the client side, which would let me avoid the more costly re-loading/processing-on-hydration situation in our own code at least... I don't think I have enough info to ignore Attribute change events though (it could be changing from writable to read-only, which is a real change, but would match expected attributes for an unaltered virtual file and I don't believe there is a way to tell if the attributes have never changed, etc). It would be ideal for them to not be generated at all, though, so code we don't own/control won't suffer similar problems, since the intent is that, to users, placeholder creation and hydration should not appear to be altering the file. That said, I can certain imagine that it might be difficult to actually implement that as could require changes to other systems... |
Beta Was this translation helpful? Give feedback.
-
Hello,
We have several applications that use FileSystemWatcher (which internally uses ReadDirectoryChangesW()) to do various things when files change.
This reports a notification when a placeholder is created, and then again when it is hydrated ... and I don't yet see a good way to ideally let the clients identify and potentially ignore/filter these events out.
The event that is particularly problematic is the hydration event, as this often fires while the file is being loaded (on another thread), exposing race conditions in some code, or just triggering additional unnecessary (and sometimes heavyweight) re-processing of the file.
Obviously we'd ideally fix the race conditions, but the re-processing would still be a problem.
Are there maybe some newer FILE_NOTIFY_CHANGE_xxx flags to filter these events out, or a way to tell this from the notification data, or some other thing I'm not thinking of by chance?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions