I'm seeking to use Change Journal instead of ReadDirectoryChangesW
to track changes in my delphi XE2 application (as for why: ReadDirectoryChangesW is not that reliable)
The closest I could find in delphi/pascal is something called Delphi MFT/Journal helpers, it contains two pascal units: uMFT.pas and uDevNotification.pas.
The code above deal with MFT (very nicely actually), but nothing as far change journal goes.
I also found this C# code, which seems to do what I want, only it's in C#
My question is: anyone knows a Delphi XE2 code (or how to convert the C# code) to interact with and/or query the change journal?
As I said, my goal is to replace the ReadDirectoryChangesW
, so I ultimately need to interact with the change journal so that I'm notified whenever there's a change in the filesystem
ReadDirectoryChangesW
would be the fallback solution (the uMFT does detect NTFS volumes). Supporting network volumes would be nice, but not really important right now. – PleiadesuMFT.pas
hasQueryUSNJournal()
andEnumMFTEntries()
functions for accessing the records of the Change Journal. Did you actually try using them yet? The MFT naming is just because the Master File Table uses the same record format as the Change Journal, so the same code can be used to enumerate records in both tables. – GelationEnumMFTEntries
but I missedQueryUSNJournal
. I'll study it, but it seems the way to go according to this description...Do I take it the change journal has no notification mechanism? – PleiadesReadDirectoryChangesW
to catch changes, and then use the changes journal to reliably get the modification date. That would fix my other issue about the unreliable file modification time. Does that make sense? – Pleiades