void UpdateRoots()
{
- bool haveUnwatchableRoots = false;
char infoBuffer [256];
strcpy_s(infoBuffer, "UNWATCHEABLE\n");
for(int i=0; i<ROOT_COUNT; i++)
sprintf_s(rootPath, 8, "%c:\\", watchRootInfos [i].driveLetter);
if (!IsWatchable(rootPath))
{
- haveUnwatchableRoots = true;
strcat_s(infoBuffer, rootPath);
strcat_s(infoBuffer, "\n");
continue;
{
StartRoot(&watchRootInfos [i]);
}
- PrintMountPoints(rootPath);
}
}
- if (haveUnwatchableRoots)
+ EnterCriticalSection(&csOutput);
+ fprintf(stdout, "%s", infoBuffer);
+ for(int i=0; i<ROOT_COUNT; i++)
{
- strcat_s(infoBuffer, "#");
- EnterCriticalSection(&csOutput);
- puts(infoBuffer);
- fflush(stdout);
- LeaveCriticalSection(&csOutput);
+ if (watchRootInfos [i].bUsed)
+ {
+ char rootPath[8];
+ sprintf_s(rootPath, 8, "%c:\\", watchRootInfos [i].driveLetter);
+ PrintMountPoints(rootPath);
+ }
}
+ puts("#");
+ fflush(stdout);
+ LeaveCriticalSection(&csOutput);
}
int _tmain(int argc, _TCHAR* argv[])