On Feb 15 04:35, Mark Geisert wrote: > Corinna Vinschen writes: > > > > Does anybody know a system call which allows to fetch the network drive > > > > state (connected/not connected) without a billion microsecond timeout? > > > > > > I just looked into this and I really don't see a way. While there's a > > > NetUseGetInfo call, which is pretty fast even for unavailable drives, > > > it's not reliable. Even if the drive is available again, it can take > > > minutes in which it still returns a status of "Session lost". I'm not > > > sure this is what we want. > > > > ...and the call doesn't work for NFS drives. Too bad. > > Does WNetGetConnection() do any better? It's referenced on the > NetUseGetInfo() > page in MSDN. Claims to support other providers besides SMB.
Yes, that's right. Alas, BTDT. The function returns success even if the share becomes unavailable. > Apart from that, is "net use" the mount table Ryan was referring to? Can we > tell what it's doing to identify connected and disconnected drives? Given it's import table it uses all functions available. I see at least these: NetUseEnum NetUseGetInfo WNetCloseEnum WNetEnumResourceW WNetOpenEnumW WNetGetConnectionW WNetGetLastErrorW WNetCancelConnection2W WNetAddConnection2W But "net use" is not quite accurate either. If you switch off a remote share it recognizes the disconmnection pretty fast, but if the share becomes available again, it stays in the disconnected state for quite some time, just like the NetUseGetInfo function. But, on second thought, maybe that's ok for us. It would at least help for SMB drives. I'll look into that again at one point. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple