Monitor File Open, Save and Close events on Windows

Announcements and discussion for PInvoke

Moderators: Luke Jefferson, Robert

Monitor File Open, Save and Close events on Windows

Postby Sumant » Wed Mar 19, 2014 5:37 am

I have a somewhat unique requirement where I need to track or monitor file open, save or close events and log the timestamp to a file or database. File could be either on the local machine or on a shared path. OS is Windows 7.

I have tried using the WMI events subscription for process creation, modification and deletion. However it works only for file types like notepad because it creates a new process for each file while Office files are managed through a single process. I stumbled across the NetFileEnum function which provides a list of files opened from a shared path. Is there a similar function which provides a list of files opened from local machine?

I am thinking if I dont get the events I have to use the polling mechanism which will run every few mins and keep checking for open and closed files. Win32 API seems to be the only option. FileWatcher does not help.

Please provide your valuable suggestions
Sumant
 
Posts: 1
Joined: Wed Mar 19, 2014 5:29 am

Return to PInvoke.Net

Who is online

Users browsing this forum: No registered users and 0 guests