There are three API things that I think you should check out:
FindFirstChangeNotification () http://msdn.microsoft.com/en-us/library/aa364417%28VS.85%29.aspx This gives you a pen that you can wait and use to look for changes to a file in a specific file, directory, or directory tree. It will not tell you when the directory is being viewed, but it will tell you when the file will be saved, renamed, etc. Etc.
SetWindowsHookEx () http://msdn.microsoft.com/en-us/library/ms644990%28v=VS.85%29.aspx You can set this to give you a callback when any number of events happen - on I'm actually pretty sure that you can get this callback when you open the directory, but it will probably be overly complicated because you will intercept messages in the Explorer window. This way you will reboot during debugging.
Windows Shells http://msdn.microsoft.com/en-us/library/bb776778%28v=VS.85%29.aspx If this wasn’t painful enough, you can try writing a shell program.
If you are trying to write a rootkit, I suppose you do not want me to spoil your details. If you are NOT trying to write a rootkit, I suggest you study it carefully. There are open source rootkits, and all of them basically should control access to files in such a way as to hide from the user / OS.
sqykly
source share