My application watches for change in specific file using ReadDirectoryChangesW Windows NT API function. Changes include file creation and last write. I user OVERLAPPED structure woth non signalled event. The structure is passed to ReadDirectoryChangesW function which immediately returns. Then I wait on event using WaitForSingleObject. When change in waching directory occurs ReadDirectoryChangesW signals event and WaitForSingleObject exits blocking state. Then I reset event and restart watch.
My problem is second time after I reset event ReadDirectoryChangesW immediately returns signaling event so I get two changes in the same file with the same parameters despite only one actual chnage (i.e. file was added to the directory) occured.
Could some one explain to me why ReadDirectoryChangesW notifies about file change twice?