Monitoring files
-
Hi all! With your help, I would like to write a program that monitors which ever files system opens, creates, writes to, reads from .... and finaly updates those neatly in it's log - same as any antivirus monitor but without virus-checking. I've written a code that uses ReadDirectoryChangesW, but it only triggers when file is launched or date/time modified. Which function should I use? It's important that my program should 'be aware' when any other program reads from certain file (ie. catch the name of INI file being read from). I hope that I was clear. I've downloaded some projects, but they didn't do. I'm using Borland C++ 5.0. Thanx
dArK cHAriSmA
-
Hi all! With your help, I would like to write a program that monitors which ever files system opens, creates, writes to, reads from .... and finaly updates those neatly in it's log - same as any antivirus monitor but without virus-checking. I've written a code that uses ReadDirectoryChangesW, but it only triggers when file is launched or date/time modified. Which function should I use? It's important that my program should 'be aware' when any other program reads from certain file (ie. catch the name of INI file being read from). I hope that I was clear. I've downloaded some projects, but they didn't do. I'm using Borland C++ 5.0. Thanx
dArK cHAriSmA
There are two options I can think of: * Write a file system driver * Poll the file system at regular intervals (probably about 100 ms) - attempt to open the file with exclusive access. If it fails, then someone else is using it. If it succeeds, close it because it's not in use. This option is a lot easier to code, but uses more CPU. -- modified at 0:06 Tuesday 16th October, 2007
-
Hi all! With your help, I would like to write a program that monitors which ever files system opens, creates, writes to, reads from .... and finaly updates those neatly in it's log - same as any antivirus monitor but without virus-checking. I've written a code that uses ReadDirectoryChangesW, but it only triggers when file is launched or date/time modified. Which function should I use? It's important that my program should 'be aware' when any other program reads from certain file (ie. catch the name of INI file being read from). I hope that I was clear. I've downloaded some projects, but they didn't do. I'm using Borland C++ 5.0. Thanx
dArK cHAriSmA
See
FindFirstChangeNotification
and How to get a notification if change occurs in a specified directory [^].