The step is:
I have been running a service program with UAC for mapping network drive using function WNetAddConnection2, then it was successful.
I ran another program with privilege of administrator(run as administrator) to call function GetFileAttribute to get network drive’s attribute, however, it was returned 0xffffffff and error code was 3(Doesn’t find the special path).
I also have tried create file on network drive, but it was still failed.
Could you please help me to solve this problem?
Thanks a lot.
In NT, a “network drive” is a symbolic link from the MS-DOS filesystem namespace to a UNC path. Those symbolic links are maintained per logon session. This also means that an Administrator has its own set of symbolic links.
The solution is to call
WNetAddConnection2in each logon session that needs to access the particular UNC network path as a drive letter.This is documented on the MSDN page :