This requires a kernel driver. Hooks and shell extensions are activated only when accessing the file through the shell (for example, in Windows Explorer), and will not start if other programs access the file directly.
I had a similar problem when working with access antivirus.
But, as @selbie said, the driver code itself cannot process any interactive hints - for this, it must contact the user mode code. It can be a standalone application, or your DLL is automatically loaded into each process. In my case, if a user response was necessary, we had a driver and user mode application exchanging via channels - the driver will send a message to the user application (if it was active), and then wait for a response. The application issued a request for a quick response and a response to a request to the driver.
The issue of connecting file I / O was also discussed in an earlier section here .
Cozzamara
source share