是否有 ICopyHook.CopyCallback 文件或替代方案?

发布于 2024-11-28 20:04:32 字数 410 浏览 10 评论 0原文

我们使用 ICopyHook.CopyCallback shell 扩展来检测 文件夹 的删除、移动和创建,但不检测文件 链接,如何检测用户是否从 C# 应用程序中删除文件,或者如何处理用户的删除操作? 示例:用户在 f1.txt 上按 Shift + DEL,然后操作系统询问“Are Yuo Sure You Want to delete 'f1.txt'?”,如果用户按 'yes',则 C# 应用程序将通过以下方式处理删除操作:以透明方式将“f1.txt”移动到某个隐藏文件夹{例如}???

注意:我认为 FileSystemWatcher 无法执行此任务..

we use ICopyHook.CopyCallback shell extension to detect deletion , moving ,creation of folders , but not files Link , How to detect if the user is deleting a file from C# Application , or How to handle the delete operation for the user ?
example : the user press Shift + DEL on f1.txt, then the operating System asks "Are Yuo sure You Want to delete 'f1.txt'? , if the user press 'yes' then the C# application will handle the deletion operation by moving 'f1.txt' to some hidden folder {for example } in transparent way ???

note : I think FileSystemWatcher can NOT do this task ..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我也只是我 2024-12-05 20:04:32

您需要一个文件系统过滤驱动程序,它将拦截文件删除或文件移动(文件被移动到回收站)的请求并采取相应的行动。

请注意,由于在文件系统级别上不存在复制文件之类的操作(ICopyHook 只能捕获由 Explorer 本身或通过 shell API 函数进行的操作),因此您将无法使用文件系统过滤器驱动程序跟踪“复制”(或通过任何其他方式)。

You need a file system filter driver, which will intercept requests for file deletion or file moving (the file is moved to recycle bin) and will act accordingly.

Note, that as there's no such operation as copying a file on file system level (ICopyHook can catch only operations carried by Explorer itself or via shell API functions), you won't be able to track "copying" using file system filter driver (or by any other means).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文