
Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi
Based on my test with Window XP+SP1 to access to a folder on Windows 2000
Server + SP4, it can not get the notification.
Here is my test code.
using System;
using System.IO;
using System.Diagnostics;
namespace FWT
{
public class Watcher
{
public static void Main()
{
string[] args = System.Environment.GetCommandLineArgs();
// If a directory is not specified, exit program.
if(args.Length != 2)
{
// Display the proper way to call the program.
Console.WriteLine("Usage: Watcher.exe (directory)");
return;
}
// Create a new FileSystemWatcher and set its properties.
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = args[1];
/* Watch for changes in LastAccess and LastWrite times, and
the renaming of files or directories. */
watcher.NotifyFilter = NotifyFilters.LastAccess |
NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
// Only watch text files.
watcher.Filter = "*.txt";
// Add event handlers.
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnChanged);
watcher.Deleted += new FileSystemEventHandler(OnChanged);
watcher.Renamed += new RenamedEventHandler(OnRenamed);
// Begin watching.
watcher.EnableRaisingEvents = true;
// Wait for the user to quit the program.
Console.WriteLine("Press \'q\' to quit the sample.");
while(Console.Read()!='q');
}
// Define the event handlers.
private static void OnChanged(object source, FileSystemEventArgs e)
{
// Specify what is done when a file is changed, created, or deleted.
Console.WriteLine("File: " + e.FullPath + " " + e.ChangeType);
}
private static void OnRenamed(object source, RenamedEventArgs e)
{
// Specify what is done when a file is renamed.
Console.WriteLine("File: {0} renamed to {1}", e.OldFullPath, e.FullPath);
}
}
}
Also I suggest you try to apply the recently Service Pack before test.
From the Document below, Windows 2000 may lost packet when it has not
install SP2 or high and the VM may have poor performance in contrast with
physically machine.
Windows NT 4.0: The limit in this situation is 4 KB.
Windows 2000: Clients that attempt multiple simultaneous long-term
requests against a server, for example change notifications, should be
running Service Pack 2 or higher. See Knowledge Base article Q271148 for
more details.
Windows Me: There is similar functionality available with the
FindFirstChangeNotification function.
ReadDirectoryChangesW
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/r
eaddirectorychangesw.asp
The FileSystemWatcher will use the API above.
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
MPS35 - 22 Jul 2005 16:39 GMT
Peter,
I'm not sure I understand your reply. Are you saying that you could not get
this to fail? You mention the KB article Q271148. This describes how it
could fail in 2000. Do these same parameters described in that article
exist in XP?
Thanks,
Mike
> Hi
>
[quoted text clipped - 90 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
"Peter Huang" [MSFT] - 23 Jul 2005 05:38 GMT
Hi
Per the KB the problem existed in Windows 2000 before service pack 2, I did
not find a similar problem with XP.
Also based on my test, the problem will not persist on a windows XP +SP1.
So I suggest you may try my code on the problem XP+SP1 to see if that is
any difference.
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.