I have an application that needs to access a share on a remote machine using the provided User name and Password, and I am making use of WNetUseConnection2 to connect to that share. the actual code was taken from here
Both of them are windows 7 64 Bit OS either a VM or a physical machine, but the issue is that on some of the machines the process is unable to access the share but in other machines it works with exactly same configurations.
when it fails, I tried to check through the Process Monitor, i see that it gives the following error:
Operation CreateFile \\;RdpDr\;:1\\199.63.65.55\MyShareName BAD NETWORK NAME
I was wondering if some one has a clue as to what is going on here, as if I use RunAS for windows explorer on that same machine and try to reach "\199.63.65.55\MyShareName" it works.
Has any one faced this issue before or have a clue as to what may be causing this on few of the machines?
Also why is it is it prefixing \\;RdpDr\;:1
to my UNC path?
Regards Kiran
Finally found the issue, I was trying to connect to 2 different share on the same machine using different Users, which apparently is not liked by the OS.
One workaround was to make use of IP address for 1st share access and second one use the machine name, this fools the windows to think that they ate 2 different machine and supplies different credentials.
Life would have been so much easier had we known that it was actually complaining about multiple connection to same machine.