在Windows中访问本地文件时获取通知 [英] Getting a notification when a local file is accessed in windows

查看:175
本文介绍了在Windows中访问本地文件时获取通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(AFAIK,通常是 Userland 代码 - by CreateFile() / NtCreateFile()

我已经知道 FileSystemWatcher 这应该在 .NET 环境中完成,但是我在 C> 事件会是完美的,但是发送一个回调来调用也是可行的。

解决方案

请参阅

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.

解决方案

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).

这篇关于在Windows中访问本地文件时获取通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆