diff --git a/bin/win/fsnotifier.exe b/bin/win/fsnotifier.exe index 47c7139daf39..0794f8cedaf2 100644 Binary files a/bin/win/fsnotifier.exe and b/bin/win/fsnotifier.exe differ diff --git a/native/fileWatcher/fileWatcher3.cpp b/native/fileWatcher/fileWatcher3.cpp index 77b8f36f8e40..9a0b3d8e5743 100644 --- a/native/fileWatcher/fileWatcher3.cpp +++ b/native/fileWatcher/fileWatcher3.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2011 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -310,6 +310,15 @@ void PrintChangeInfo(char *rootPath, FILE_NOTIFY_INFORMATION *info) LeaveCriticalSection(&csOutput); } +void PrintEverythingChangedUnderRoot(char *rootPath) +{ + EnterCriticalSection(&csOutput); + puts("RECDIRTY"); + puts(rootPath); + fflush(stdout); + LeaveCriticalSection(&csOutput); +} + DWORD WINAPI WatcherThread(void *param) { WatchRootInfo *info = (WatchRootInfo *) param; @@ -353,13 +362,30 @@ DWORD WINAPI WatcherThread(void *param) } if (rc == WAIT_OBJECT_0+1) { - FILE_NOTIFY_INFORMATION *info = (FILE_NOTIFY_INFORMATION *) buffer; - while(true) + DWORD dwBytesReturned; + if(!GetOverlappedResult(hRootDir, &overlapped, &dwBytesReturned, FALSE)) { - PrintChangeInfo(rootPath, info); - if (!info->NextEntryOffset) + info->bFailed = true; + break; + } + + if (dwBytesReturned == 0) + { + // don't send dirty too much, everything is changed anyway + if (WaitForSingleObject(info->hStopEvent, 500) == WAIT_OBJECT_0) break; - info = (FILE_NOTIFY_INFORMATION *) ((char *) info + info->NextEntryOffset); + + // Got a buffer overflow => current changes lost => send RECDIRTY on root + PrintEverythingChangedUnderRoot(rootPath); + } else { + FILE_NOTIFY_INFORMATION *info = (FILE_NOTIFY_INFORMATION *) buffer; + while(true) + { + PrintChangeInfo(rootPath, info); + if (!info->NextEntryOffset) + break; + info = (FILE_NOTIFY_INFORMATION *) ((char *) info + info->NextEntryOffset); + } } } } diff --git a/native/fileWatcher/targetver.h b/native/fileWatcher/targetver.h index b098d2ce0459..7021c2a55bec 100644 --- a/native/fileWatcher/targetver.h +++ b/native/fileWatcher/targetver.h @@ -8,6 +8,6 @@ // Modify the following defines if you have to target a platform prior to the ones specified below. // Refer to MSDN for the latest info on corresponding values for different platforms. #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. -#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target other versions of Windows. +#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif