views:

220

answers:

3

hi All,

Consider that i have connected to multiple shares of a remote machine( \\machineA\share1, \\machineA\share2....) along with shares on other remote machines.

Now my question is how to find only those shares which are connected to a particular machine. For eg, only those shares which are connected to machineA.

I already came across WNetOpenEnum and WNetEnumResource. But these are highly inefficient that they will return all shares which are connected to my machine and then i will have to search through the results for the shares connected to machineA:(

I need to know if there is some other function, using which i can find the share.

I am working on VC++ 6.0.

edit: Hey guys having another trouble. Whenever i try to connect to a share on the machine i get the following error: "The referenced account is currently locked out and may not be logged on to" Has anyone encountered this problem and how was it solved

A: 

Iterating through all shares and only picking the ones you want, to me, looks as efficient as it gets. Is there some circumstance why you can't do it? (except laziness ;))

Piskvor
hmm, i was just thinking it might effect perfomance if there are many shares right?
Raghu
A: 
foreach (string systemName in systemNames)
 System.IO.Directory.GetDirectories("\\"+systemName+"\");
tsilb
can this be used in VC 6.0?
Raghu
A: 

To resolve your lockout problem, log onto a the target server (Or, if it's on a domain, log onto any domain controller on that domain), go to Control Panel > Administrative Tools > Active Directory Users & Computers, navigate to the User you're logging in as, and unlock it.

If the system is not on a domain, simply log onto it and unlock the account via the "Local users & Groups" tool in compmgmt.msc.

tsilb
When someone answers your question and the answer is helpful, you're expected to return the favor by clicking the 'up' arrow to the left of the post.
tsilb