拦截windows打开的文件
我正在尝试制作一个可以拦截文件打开过程的小程序.
I'm trying to make a small program that could intercept the open process of a file.
目的是当用户双击给定文件夹中的文件时,windows会通知软件,然后它处理该请求并将文件数据返回给windows.
The purpose is when an user double-click on a file in a given folder, windows would inform to the software, then it process that petition and return windows the data of the file.
也许会有另一种解决方案,例如监视打开的消息并强制 Windows 在程序准备文件内容时等待.
Maybe there would be another solution like monitoring Open messages and force Windows to wait while the program prepare the contents of the file.
这个概念的一个应用,可以是以对用户透明的方式管理文件的解密.在这种情况下,加密文件将在磁盘上,当用户打开它时(双击它或使用某些应用程序,如记事本),后台进程将拦截该打开事件,解密文件并提供内容将该文件发送给请求的应用程序.
One application of this concept, could be to manage desencryption of a file in a transparent way to the user. In this context, the encrypted file would be on the disk and when the user open it ( with double-click on it or with some application such as notepad ), the background process would intercept that open event, desencrypt the file and give the contents of that file to the asking application.
这是一个有点奇怪的概念,它可能类似于中间人"网络概念,但使用的是文件而不是网络数据包.
It's a little bit strange concept, it could be like "Man In The Middle" network concept, but with files instead of network packets.
感谢阅读.
推荐答案
要涵盖从任何程序打开的所有情况,最好的方法是通过 文件系统过滤器驱动程序.不过,这对于您的需求来说可能太复杂了.
The best way to do it to cover all cases of opening from any program would be via a file system filter driver. This may be too complex for your needs though.
相关文章