Home > Back-end >  Why WNetAddConnection2 return code is 87?
Why WNetAddConnection2 return code is 87?

Time:09-22

AnsiString sMainRoot=ini - & gt; ReadString (" PathSetting MainRoot ", ""," ");
AnsiString UserName=ini - & gt; ReadString (" PathSetting ", "Username", "");
AnsiString PassWord=ini - & gt; ReadString (" PathSetting ", "Password", "");
AnsiString DirName=sMainRoot;
AnsiString LName="";
NETRESOURCE NR.
NR. DwType=RESOURCETYPE_ANY;
NR. LpRemoteName=DirName. C_str ();
NR. LpLocalName=LName. C_str ();
NR. LpProvider=NULL;
Long lRet;
DWORD sError;
Try
{

LRet=WNetAddConnection2 (& amp; NR, PassWord. C_str (), UserName, c_str (), CONNECT_UPDATE_PROFILE);

If (lRet)
{
AnsiString s=lRet;
ShowMessage (s);
}
}
The catch (... )
{
return;
}

CodePudding user response:

87 is a parameter problem, try to empty NR a assignment again,
ZeroMemory (& amp; Nr, sizeof (nr));

CodePudding user response:

Reset, or not
  • Related