mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 05:25:48 +00:00
[FORMATTING] Remove trailing whitespace. Addendum to 34593d93
.
Excluded: 3rd-party code (incl. wine) and most of the win32ss.
This commit is contained in:
parent
bbabe2489e
commit
9393fc320e
701 changed files with 14685 additions and 14693 deletions
|
@ -35,8 +35,8 @@ int _tmain(int argc, TCHAR *argv[])
|
|||
|
||||
void WatchDirectory(LPTSTR lpDir)
|
||||
{
|
||||
DWORD dwWaitStatus;
|
||||
HANDLE dwChangeHandles[2];
|
||||
DWORD dwWaitStatus;
|
||||
HANDLE dwChangeHandles[2];
|
||||
TCHAR lpDrive[4];
|
||||
TCHAR lpFile[_MAX_FNAME];
|
||||
TCHAR lpExt[_MAX_EXT];
|
||||
|
@ -45,93 +45,93 @@ void WatchDirectory(LPTSTR lpDir)
|
|||
|
||||
lpDrive[2] = (TCHAR)'\\';
|
||||
lpDrive[3] = (TCHAR)'\0';
|
||||
|
||||
// Watch the directory for file creation and deletion.
|
||||
|
||||
dwChangeHandles[0] = FindFirstChangeNotification(
|
||||
lpDir, // directory to watch
|
||||
FALSE, // do not watch subtree
|
||||
FILE_NOTIFY_CHANGE_FILE_NAME); // watch file name changes
|
||||
|
||||
if (dwChangeHandles[0] == INVALID_HANDLE_VALUE)
|
||||
|
||||
// Watch the directory for file creation and deletion.
|
||||
|
||||
dwChangeHandles[0] = FindFirstChangeNotification(
|
||||
lpDir, // directory to watch
|
||||
FALSE, // do not watch subtree
|
||||
FILE_NOTIFY_CHANGE_FILE_NAME); // watch file name changes
|
||||
|
||||
if (dwChangeHandles[0] == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("\n ERROR: FindFirstChangeNotification function failed.\n");
|
||||
ExitProcess(GetLastError());
|
||||
ExitProcess(GetLastError());
|
||||
}
|
||||
|
||||
// Watch the subtree for directory creation and deletion.
|
||||
|
||||
dwChangeHandles[1] = FindFirstChangeNotification(
|
||||
lpDrive, // directory to watch
|
||||
TRUE, // watch the subtree
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME); // watch dir name changes
|
||||
|
||||
if (dwChangeHandles[1] == INVALID_HANDLE_VALUE)
|
||||
|
||||
// Watch the subtree for directory creation and deletion.
|
||||
|
||||
dwChangeHandles[1] = FindFirstChangeNotification(
|
||||
lpDrive, // directory to watch
|
||||
TRUE, // watch the subtree
|
||||
FILE_NOTIFY_CHANGE_DIR_NAME); // watch dir name changes
|
||||
|
||||
if (dwChangeHandles[1] == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("\n ERROR: FindFirstChangeNotification function failed.\n");
|
||||
ExitProcess(GetLastError());
|
||||
ExitProcess(GetLastError());
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Make a final validation check on our handles.
|
||||
|
||||
if ((dwChangeHandles[0] == NULL) || (dwChangeHandles[1] == NULL))
|
||||
{
|
||||
printf("\n ERROR: Unexpected NULL from FindFirstChangeNotification.\n");
|
||||
ExitProcess(GetLastError());
|
||||
ExitProcess(GetLastError());
|
||||
}
|
||||
|
||||
// Change notification is set. Now wait on both notification
|
||||
// handles and refresh accordingly.
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
// Change notification is set. Now wait on both notification
|
||||
// handles and refresh accordingly.
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
// Wait for notification.
|
||||
|
||||
|
||||
printf("\nWaiting for notification...\n");
|
||||
|
||||
dwWaitStatus = WaitForMultipleObjects(2, dwChangeHandles,
|
||||
FALSE, INFINITE);
|
||||
|
||||
switch (dwWaitStatus)
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
|
||||
dwWaitStatus = WaitForMultipleObjects(2, dwChangeHandles,
|
||||
FALSE, INFINITE);
|
||||
|
||||
switch (dwWaitStatus)
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
|
||||
// A file was created, renamed, or deleted in the directory.
|
||||
// Refresh this directory and restart the notification.
|
||||
|
||||
RefreshDirectory(lpDir);
|
||||
|
||||
RefreshDirectory(lpDir);
|
||||
if ( FindNextChangeNotification(dwChangeHandles[0]) == FALSE )
|
||||
{
|
||||
printf("\n ERROR: FindNextChangeNotification function failed.\n");
|
||||
ExitProcess(GetLastError());
|
||||
ExitProcess(GetLastError());
|
||||
}
|
||||
break;
|
||||
|
||||
case WAIT_OBJECT_0 + 1:
|
||||
|
||||
break;
|
||||
|
||||
case WAIT_OBJECT_0 + 1:
|
||||
|
||||
// A directory was created, renamed, or deleted.
|
||||
// Refresh the tree and restart the notification.
|
||||
|
||||
RefreshTree(lpDrive);
|
||||
|
||||
RefreshTree(lpDrive);
|
||||
if (FindNextChangeNotification(dwChangeHandles[1]) == FALSE )
|
||||
{
|
||||
printf("\n ERROR: FindNextChangeNotification function failed.\n");
|
||||
ExitProcess(GetLastError());
|
||||
ExitProcess(GetLastError());
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
case WAIT_TIMEOUT:
|
||||
|
||||
// A timeout occurred, this would happen if some value other
|
||||
// A timeout occurred, this would happen if some value other
|
||||
// than INFINITE is used in the Wait call and no changes occur.
|
||||
// In a single-threaded environment you might not want an
|
||||
// INFINITE wait.
|
||||
|
||||
|
||||
printf("\nNo changes in the timeout period.\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
printf("\n ERROR: Unhandled dwWaitStatus.\n");
|
||||
ExitProcess(GetLastError());
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue