ReadDirectoryChangesW: how to detect that the operation was successfully queued?

StackOverflow https://stackoverflow.com/questions/18635483

  •  27-06-2022
  •  | 
  •  

Frage

After calling ReadDirectoryChangesW (in overlapped mode) it returns 1 (true) in two opposite situations: 1) no files changes, 2) one or more file changed; But in first situation no data passed to IOCP and in second situation passed pointer to my overlapped struct.

How to determine if it passed my overlapped struct or not to IOCP while calling ReadDirectoryChangesW ? In another words how to determine does ReadDirectoryChangesW found changes or not?

In some part of my code I call GetQueuedCompletionStatus and get full information about changed files, but before it I wanna to know only fact: was changes or not;

War es hilfreich?

Lösung

If you're using ReadDirectoryChangesW() with an IOCP then you're using it in asynchronous mode and so after calling it you should wait for it to report the next change as it occurs.

Once you get a completion notification from the IOCP you can process it and then call ReadDirectoryChangesW() again to get more notifications.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top