問題描述
我正在嘗試制作一個可以攔截文件打開過程的小程序.
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.
這篇關于攔截windows打開的文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!