mardi 2 octobre 2018

Using ReadDirectoryChangesW from a DLL does not raise events, (Synchronous or Asynchronous)

I am using ::ReadDirectoryChangesW to monitor a folder.

I have full access to the folder, and that folder, (for testing), only has 2 or 3 files in it.

First I open the directory using CreateFileW

_hDirectory = ::CreateFileW(
    _path,
    FILE_LIST_DIRECTORY,
    FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
    nullptr,
    OPEN_EXISTING,
    FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED,
    nullptr
  );

The handle returned is valid.

I then monitor the folder for changes using ReadDirectoryChangesW

::ReadDirectoryChangesW(
    _hDirectory,
    _buffer,
    BUFFER_SIZE,
    _recursive,
    flags,
    nullptr,
    &_overlapped,
    &FileIoCompletionRoutine      

The callback funtion, FileIoCompletionRoutine is defined as per the doc. and the OVERLAPPED value, _overlapped is zeroed before the call.

The function returns true and no errors are raised.

I have also tried without a Completion routine, (but rather waiting for a raised event), but without any luck.

The only thing I can think of is that I am using ReadDirectoryChangesW from a DLL, but that's about it.

What could the issue be?

Aucun commentaire:

Enregistrer un commentaire