WNetAddConnection2
-
Hy leute,
ich versuch grad ein Netzlaufwerk einzubinden bekomme aber immer Fehlercode 1231 : ERROR_NETWORK_UNREACHABLE. Was stimmt den da unten nicht ?
C/C++ Code:
...stringstream constrstream;
string constr;
constrstream << "\\\" << ip.c_str() << "\\Admin$";
constr = constrstream.str();NETRESOURCE netresource;
memset(&netresource, 0, sizeof netresource);
netresource.lpRemoteName = (LPSTR)constr.c_str();
netresource.dwType = RESOURCETYPE_DISK;
netresource.lpLocalName = NULL;
netresource.lpProvider = NULL;DWORD rc = WNetAddConnection2(&netresource, password.c_str(), "Administrator", 0);
....
C/C++ Code:
...stringstream constrstream;
string constr;
constrstream << "\\\" << ip.c_str() << "\\Admin$";
constr = constrstream.str();NETRESOURCE netresource;
memset(&netresource, 0, sizeof netresource);
netresource.lpRemoteName = (LPSTR)constr.c_str();
netresource.dwType = RESOURCETYPE_DISK;
netresource.lpLocalName = NULL;
netresource.lpProvider = NULL;DWORD rc = WNetAddConnection2(&netresource, password.c_str(), "Administrator", 0);
....
C/C++ Code:
...stringstream constrstream;
string constr;
constrstream << "\\\" << ip.c_str() << "\\Admin$";
constr = constrstream.str();NETRESOURCE netresource;
memset(&netresource, 0, sizeof netresource);
netresource.lpRemoteName = (LPSTR)constr.c_str();
netresource.dwType = RESOURCETYPE_DISK;
netresource.lpLocalName = NULL;
netresource.lpProvider = NULL;DWORD rc = WNetAddConnection2(&netresource, password.c_str(), "Administrator", 0);
....
Hat jemand nen Rat ?
-
Entschuldigt bitte den oberen Eintrag. Keine ahnung was da passiert ist.
So lautet es richtig.
ich versuch grad ein Netzlaufwerk einzubinden bekomme aber immer Fehlercode 1231 : ERROR_NETWORK_UNREACHABLE. Was stimmt den da unten nicht ?
stringstream constrstream; string constr; constrstream << "\\\\" << ip.c_str() << "\\Admin$"; constr = constrstream.str(); NETRESOURCE netresource; memset(&netresource, 0, sizeof netresource); netresource.lpRemoteName = (LPSTR)constr.c_str(); netresource.dwType = RESOURCETYPE_DISK; netresource.lpLocalName = NULL; netresource.lpProvider = NULL; DWORD rc = WNetAddConnection2(&netresource, password.c_str(), "Administrator", 0);
Weis jemand Rat ?
-
Nachtrag:
in dem String ip befindet sich eine normale dotted IP. Also z.b: 192.168.0.1