Unpacks events and passes them to a user defined callback.
13 PFILE_NOTIFY_INFORMATION pNotify;
14 WatcherStructWin32 * tWatch = (WatcherStructWin32*) lpOverlapped;
15 WatcherWin32 * pWatch = tWatch->Watch;
18 if (dwNumberOfBytesTransfered == 0)
30 pNotify = (PFILE_NOTIFY_INFORMATION) &pWatch->mBuffer[offset];
31 offset += pNotify->NextEntryOffset;
33 int count = WideCharToMultiByte(CP_UTF8, 0, pNotify->FileName,
34 pNotify->FileNameLength /
sizeof(WCHAR),
36 szFile[count] = TEXT(
'\0');
38 std::string nfile( szFile );
40 if ( FILE_ACTION_MODIFIED == pNotify->Action )
42 FileInfo fifile( std::string( pWatch->DirName ) + nfile );
44 if ( pWatch->LastModifiedEvent.file.ModificationTime == fifile.ModificationTime && pWatch->LastModifiedEvent.file.Size == fifile.Size && pWatch->LastModifiedEvent.fileName == nfile )
49 pWatch->LastModifiedEvent.fileName = nfile;
50 pWatch->LastModifiedEvent.file = fifile;
55 pWatch->Watch->handleAction(pWatch, nfile, pNotify->Action);
57 }
while (pNotify->NextEntryOffset != 0);
#define MAX_PATH
Definition: CascPort.h:160
arena_t NULL
Definition: jemalloc_internal.h:624
#define ERROR_SUCCESS
Definition: CascPort.h:204
bool RefreshWatch(WatcherStructWin32 *pWatch)
Refreshes the directory monitoring.
Definition: WatcherWin32.cpp:67