Problem: Watching Directories from WinNT+
Claus Faber
claus.faber at x-packed.de
Wed Jul 23 10:30:59 GMT 2003
Hi there,
I'm trying to watch the changes in a directory from WinNT (XP as a matter of
fact). It works fine watching directories on a remote WinNT computer but
doesn't with a remote Samba Server:
When a change in the watched directory occurs, ReadDirectoryChangesW()
returns with error 59 (=ERROR_UNEXP_NET_ERR). If a try the same approach
with async communication ReadDirectoryChangesW() works fine but
GetOverlappedResult() returns with the same error message. Looks like that
Samba isn't sending a proper return packet.
I really do appreciate any feedback on this problem,
Thanks in advance,
Claus
Here's the code running on my WinNT machine:
if(!(hFile=CreateFile(
"\\\\Mephisto\\test",
FILE_LIST_DIRECTORY,
FILE_SHARE_READ
| FILE_SHARE_WRITE
| FILE_SHARE_DELETE,
0,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL ))){
// failed
dwErr = ::GetLastError();
}else{
while(1){
if(!ReadDirectoryChangesW( hFile,
byBuffer,
BUFSIZE,
FALSE,
FILE_NOTIFY_CHANGE_FILE_NAME,
&dwNbBytes,
0, 0
)){
// error
dwErr=::GetLastError();
CloseHandle(hFile);
hFile=0;
break;
}else{
dwErr=0;
}
} // wend
}
More information about the samba-technical
mailing list