Hi,
I have developed an application to establish VPN Connection
programmatically.
I have followed these steps and I getting Error: 80070057
A/c to MSDN, the error implies one or more invalide arguments. Can
anyone plz let me know what's the error in the code:
GUID destNet = { 0x1CA3AF08, 0xEDE3, 0xF66C, { 0xB1, 0xA7, 0x64, 0x3C,
0x64, 0xDE, 0x35, 0x74 } };
The above destNet GUID is taken from the Registry value for the VPN
Entry created manually.
We can also create the VPN Entry programmatically.
CONNMGR_CONNECTIONINFO ConnInfo={0};
ConnInfo.cbSize=sizeof(ConnInfo);
ConnInfo.dwParams=CONNMGR_PARAM_GUIDDESTNET;
ConnInfo.dwFlags=0;
ConnInfo.dwPriority=CONNMGR_PRIORITY_USERINTERACTIVE;
ConnInfo.bDisabled = false;
ConnInfo.bExclusive = false;
ConnInfo.guidDestNet = destNet;
if ((hr = ConnMgrEstablishConnectionSync(&ConnInfo, phConnection,
60000, pdwStatus)) != S_OK &&
(int)pdwStatus != CONNMGR_STATUS_CONNECTED)
{
printf(("Function Establish failed (0x%08x). %02X, %02X\n",
GetLastError(),hr,(int)pdwStatus));
}
else if((int)pdwStatus == CONNMGR_STATUS_CONNECTED)
{
printf(" VPN Connection Successful"));
return SUCCESS;
}
thanks
Phani