问题
I'd like to get notified when a specific file get accessed (AFAIK, most generally for a Userland
code - by CreateFile()
/ NtCreateFile()
)
I already know about FileSystemWatcher
which should do the same within the .NET
environment, But I'm working in plain C
+ WinAPI
.
As for the type of notification , raising a specified Event
would be perfect, but sending a callback
to be called , will also work.
回答1:
See FindFirstChangeNotification function in WinAPI and related links.
Alternatively, when functionality of that function is not enough, you can use a filesystem filter driver (write yours or use our CallbackFilter product).
来源:https://stackoverflow.com/questions/19834628/getting-a-notification-when-a-local-file-is-accessed-in-windows