Thread View: borland.public.cppbuilder.nativeapi
1 messages
1 total messages
Started by Kris
Sat, 09 Jun 2007 14:29
Network share mapping sequence fails on Vista
Author: Kris
Date: Sat, 09 Jun 2007 14:29
Date: Sat, 09 Jun 2007 14:29
37 lines
2505 bytes
2505 bytes
Hi, I've written an application that maps several network shares to drive letters. To accomplish this I repeat the sequence below for every share that needs to be mapped (typically 3 to 4 shares): - WNetCancelConnection2() - remove any previous mapping that might exist - WNetAddConnection3() - create a new mapping This is pretty straightforward and works great on all operating systems except, strangely enough, Vista. For some reason, after executing the above sequence several times (once for each share), the mapped connections regularly do not become visible as drive letters. Only after a reboot they show up. And, even though the mappings clearly went wrong, no error is returned by any of the WNetxxx-calls I made. Furthermore, if you use WNetGetUniversalName() to query the UNC of those badly mapped drive letters you won't get a network path back (which is consistent with the mappings being absent in My Computer). However, if you use WNetEnumResource() to enumerate RESOURCE_REMEMBERED items you do get back the UNC that is assigned to the drive letter even though it does not show up in My Computer. So, the mapping is there (as confirmed after a reboot) but initially does not show up in My Computer. I believe I managed to work around the problem by slowing down the sequence of disconnecting/connecting drive letters; After WNetCancelConnection2() I suspend everything by using Sleep(100). The same is done after the WNetAddConnection3(). Even though this apparently contained the problem I am still a bit worried about this solution since I don't know the root-cause of the problem. Any insight on this problem is very much appreciated. Thanks. Kris
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads