I know how to use FindFirstChangeNotification
and related functions in C++ (or FileSystemWatcher
in .NET) to obtain directory change notifications in my own program.
What I'm looking for is a way to check whether another process currently has registered a change notification for a certain directory folder.
I.e. I want to have a function that I can ask:
Does process "dropbox.exe" currently monitor "C:\MyFiles"?
I found no way of getting down to the system "repository" where Windows keeps a list of notification handlers for a certain directory.
The closest I came was:
- Enumerate all processes with the name "dropbox.exe".
- For each process list all file handles it has currently open.
Still, I'm not sure, whether a change notification is actually a file handle at all.
So my question:
How can I see directory change notification handles for a given directory path and a given process ID.
Update 1:
I do hope I'm not asking an XY problem; my primary goal is to see whether Dropbox is actively running and is configured for the currently logged in user.
(I could be completely wrong in my assumption that Dropbox uses Windows directory/file change notifications at all).