I'm not using a domain, and both computers are Windows XP SP1. I can
access the shares on the other computer no problem using Explorer or
even from the DOS prompt.
The remote name is passed in the normal format of
\\MACHINENAME\SHARENAME\ and I've tried both MACHINENAME\USERNAME and
USERNAME for the username. I've also tried passing nil for the username
and password. I've tried everything but it just refuses to work.
Any help appreciated.
For XP Home share you typically can only access it as the guest account.
Make sure the guest account is active and pass NULL for username and the
guest password in the password field.
char path[80];
UINT error=0;
NETRESOURCE nr;
memset(&nr, 0, sizeof(NETRESOURCE));
if (*server_path)
sprintf(path, "\\\\%s\\%s",server_name, server_path);
else
sprintf(path, "\\\\%s",server_name);
nr.dwType = RESOURCETYPE_DISK;
nr.lpLocalName = NULL;
nr.lpRemoteName = path;
nr.lpProvider = NULL;
//retryconnect:
if (*username == 0)
{
if (*password == 0)
error = WNetAddConnection2(&nr, NULL, NULL, 0);
else
error = WNetAddConnection2(&nr, password, NULL, 0);
}
else
error = WNetAddConnection2(&nr, password, username, 0);
My code is identical, but I'm still getting the same error :( Also, I'm
using XP Pro.
Thanks anyway.
"Michael J. Leaver" <sp...@mjleaver.com> wrote in message
news:evRV6zk2...@tk2msftngp13.phx.gbl...
Can you map the share with "net use"?
Have you tried it without the trailing backslash?
--
Ken Wickes [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.
Thanks Ken! Seems it works without the trailing backslash...very strange
because I'm positive I'd already tried that several times...