Home > Software engineering > WNetAddConnection2 () returns a value of 5, but you can manually open the Shared directory access
WNetAddConnection2 () returns a value of 5, but you can manually open the Shared directory access
Time:09-22
Using WNetAddConnection2 () function, NETRESOURCE dwType=RESOURCETYPE_DISK, lpLocalName and lpRemoteName assignment, lpProvider is empty; Password and user name is empty, do not need the user name and password; Mark is CONNECT_UPDATE_PROFILE
After the function return value is always 5, but you can manually open the Shared directory access, can also manually, but failed to perform functions are always
Pray god to save
CodePudding user response:
Try to administrator privileges to run authority is not enough?
CodePudding user response:
ERROR_ACCESS_DENIED The caller does not have access to The network resource.
With administrator privileges to run your program
CodePudding user response:
Use administrator privileges to run, but still return to 5