Detecting changes to file system and/or registry
I need to detect changes to (certain) files whenever they are accessed, a bit similar to what a virus scanner does with on-access scan.
Also, I need to get notified whenever a change of any kind is made in the registry.
Rather than taking snapshots of the file(s) or registry and then compare them to what I had earlier, I was hoping to be able to get some sort of event that I could subscribe to. Is that possible?
Re: Detecting changes to file system and/or registry
Quote:
I need to detect changes to (certain) files whenever they are accessed
ReadDirectoryChanges
Re: Detecting changes to file system and/or registry
A good start, I suppose, but I'd hoped for something that would send an event to me when it happened. I suppose that I will have to poll the directory I watch (which by choosing C:\ I suppose will give me all changes on that drive for instance). Hm...but it did say something about an asynchronous operation...I wonder if I could call it and order it to return whenever something happened. Then I would sort of have an event sent to me...
Re: Detecting changes to file system and/or registry
Quote:
A good start, I suppose, but I'd hoped for something that would send an event to me when it happened.
It does. Use the async implementation. The callback function will be triggered if something happened. Google a bit for 'filewatcher c++'... there are a lot of ready to use classes out there.
Re: Detecting changes to file system and/or registry
Cool, thanks.
I hope there's something similar for the registry...
Re: Detecting changes to file system and/or registry
RegNotifyChangeKeyValue should provide registry notification.
Re: Detecting changes to file system and/or registry
It seems we're on the right track here. :-)
However, while RegNotifyChangeKeyValue() will tell that something has changed, it seems that in order to get to know *what* was changed, one needs either Vista or Server 2008. Since there are still lots of XP clients out there, I hope there is also something to get details of the change that will support XP.