I mount the remote drive locally (see Problems with user / password using GetVolumeNameForVolumeMountPoint () (remote Windows hard drive?) )
QUESTION: What is the difference between WNetAddConnection2() and NetUseAdd() ? It seems that each of them allows you to assign the path of the remote drive to the letter of the local drive with a username and password.
In addition, I can call WNetAddConnection2() indicate the local drive letter (it works) or specify "NULL" for the local drive letter, and the console command net use will show that the remote drive is deleted to "nothing" locally - as expected - but I am not sure of the purpose of such a result. I hope it sets up “login credentials” between the local system / process and the remote computer so that other calls ::GetVolumeNameForVolumeMountPoint() would have the correct username / password context, but this does not work for me.
The ultimate goal is to locally localize the remote drive without the local drive letter (something like a local shared GUID path, since all 26 letters of the local drive are already in use), but all calls ::GetVolumeNameForVolumeMountPoint() with Logon failure: unknown user name or bad password >, even after I successfully remotely mount the drive letter of the local drive, providing the remote username and password (currently using WNetAddConnection2() ).
source share