The app tracks directory change which works fine for normal directories but for network mapped drives app gets event that directory has changed without any real change. That is happening just after starting tracking the drive.
BOOL bResult = ReadDirectoryChangesExW(pSettings->m_DirectoryHandle, &pSettings->m_dirChangedBuffer,
sizeof(pSettings->m_dirChangedBuffer), pSettings->m_bIsRecursive,
pSettings->m_dwNotifyFilter, NULL, &pSettings->m_overlapped, NULL,
ReadDirectoryNotifyExtendedInformation);
//
if (!GetOverlappedResult(dirHandle, &(pSettings->m_overlapped), &bytesTransferred, TRUE))
{
auto res = GetLastError();
//assert(false);
return {};
}
// here bytesTransferred is 0 for both normal and network drives
DWORD dwDesiredAccess = FILE_LIST_DIRECTORY;
DWORD dwSharedMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
DWORD dwCreationDisposition = OPEN_EXISTING;
DWORD dwFlags = FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED;
m_DirectoryHandle = CreateFileW(strRootFolderPath, dwDesiredAccess, dwSharedMode,
NULL, dwCreationDisposition, dwFlags, NULL);
When app tries to track Z:
or Z:aaa
it gets notification that directory has changed, but for normal directories event is emitted only when new file is created, deleted, renamed.
Do you encounter similar issue. Should I try using another API for tracking network mapped drives.