Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-07-15 22:18:03 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-07-15 22:18:03 +0400
commit5e5a84371166bdee1cd35c6692b09b989e62ce61 (patch)
treeb08d789f50ce22f7006b3585a13e934f4c70a3a1 /winsup/cygwin/fhandler_netdrive.cc
parent8b800efea52a06359fbf75e4957e23ba2e8c24ca (diff)
* fhandler_netdrive.cc (GET_RESOURCE_INFO): Remove.
(thread_netdrive): Drop GET_RESOURCE_INFO case. (fhandler_netdrive::exists): Use GET_RESOURCE_OPENENUM info class to check for existance.
Diffstat (limited to 'winsup/cygwin/fhandler_netdrive.cc')
-rw-r--r--winsup/cygwin/fhandler_netdrive.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/winsup/cygwin/fhandler_netdrive.cc b/winsup/cygwin/fhandler_netdrive.cc
index c6d8892d5..3de2278ef 100644
--- a/winsup/cygwin/fhandler_netdrive.cc
+++ b/winsup/cygwin/fhandler_netdrive.cc
@@ -23,7 +23,6 @@ details. */
enum
{
- GET_RESOURCE_INFO = 0,
GET_RESOURCE_OPENENUM = 1,
GET_RESOURCE_OPENENUMTOP = 2,
GET_RESOURCE_ENUM = 3
@@ -57,11 +56,6 @@ thread_netdrive (void *arg)
ReleaseSemaphore (ndi->sem, 1, NULL);
switch (ndi->what)
{
- case GET_RESOURCE_INFO:
- nro = (LPNETRESOURCE) alloca (size = 4096);
- ndi->ret = WNetGetResourceInformation ((LPNETRESOURCE) ndi->in,
- nro, &size, &dummy);
- break;
case GET_RESOURCE_OPENENUMTOP:
nro = (LPNETRESOURCE) alloca (size = 4096);
nh = (struct net_hdls *) ndi->out;
@@ -164,15 +158,20 @@ fhandler_netdrive::exists ()
*to = (*from == '/') ? '\\' : *from;
*to = '\0';
+ struct net_hdls nh = { NULL, NULL };
NETRESOURCE nr = {0};
- nr.dwScope = RESOURCE_GLOBALNET;
nr.dwType = RESOURCETYPE_DISK;
- nr.lpLocalName = NULL;
nr.lpRemoteName = namebuf;
- DWORD ret = create_thread_and_wait (GET_RESOURCE_INFO, &nr, NULL, 0,
- "WNetGetResourceInformation");
- if (ret != ERROR_MORE_DATA && ret != NO_ERROR)
- return 0;
+ DWORD ret = create_thread_and_wait (GET_RESOURCE_OPENENUM,
+ &nr, &nh, 0, "WNetOpenEnum");
+ if (ret != NO_ERROR)
+ {
+ if (nh.dom)
+ WNetCloseEnum (nh.dom);
+ if (nh.net)
+ WNetCloseEnum (nh.net);
+ return 0;
+ }
return 1;
}