views:

125

answers:

1

Hi,

I am currently trying to access a network share from my machine programaticaly using vc++ 6.0. I am using WNetAddConnection2 to connect to a share using my credentials.

I am facing the following problem: Consider the case when there are 2 users trying to access the same remote share from same machine one after the other. Now once a user logins, the other user is not able to login into the share using his credentials until the 1st user logouts.

Also if the 1st user logs onto the remote-machine's root share, then the other user is not able to access anyother share on that machine.

Please let me know if there is any workaround for the same.

Thanks in advance

A: 

The answer depends on if the 1st user still needs access. If they don't, then call WNetCancelConnection2(). If they do, Keith Brown in his "Programming Windows Security" book has a trick of calling LogonUser() to establish a new logon session, which creates a new SMB "port" to avoid the conflict. After impersonation, your thread will be able to connect using different credentials.

Tony Lee