I have shared network folder on my disk C:\folder.
When I use WNetAddConnection2 I get error 1200. My code is:
DWORD dwResult;
NETRESOURCE nr;
nr.dwType = RESOURCETYPE_ANY;
nr.lpLocalName = (LPWSTR)"folder";
nr.lpRemoteName = (LPWSTR)"\\\\ASYA\\folder";
nr.lpProvider = NULL;
dwResult = WNetAddConnection2(&nr,NULL,(LPCWSTR) "Nastya",CONNECT_UPDATE_PROFILE);
if (dwResult == NO_ERROR)
wprintf(L"Connection added to %s\n", nr.lpRemoteName);
else
wprintf(L"WNetAddConnection2 failed with error: %u\n", dwResult);
What is my mistake? How can I solve this problem?