Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is FindFirstChangeNotification the best API to use for file system change notification on windows?

I'm new to windows programming and I'm trying to get notified of all changes to the file system (similar to the information that FileMon from SysInternals displays, but via an API). Is a FindFirstChangeNotification for each (non-network, non-substed) drive my best bet or are there other more suitable C/C++ APIs?

like image 783
Free Wildebeest Avatar asked Aug 19 '08 17:08

Free Wildebeest


1 Answers

FindFirstChangeNotification is fine, but for slightly more ultimate power you should be using ReadDirectoryChangesW. (In fact, it's even recommended in the documentation!)

It doesn't require a function pointer, it does require you to manually decode a raw buffer, it uses Unicode file names, but it is generally better and more flexible.

On the other hand, if you want to do what FileMon does, you should probably do what FileMon does and use IFS to create and install a file system filter.

like image 159
Mat Noguchi Avatar answered Sep 27 '22 18:09

Mat Noguchi