Getting a notification when a local file is accessed in windows

♀尐吖头ヾ 提交于 2019-12-11 13:35:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!