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

Re: VPN Connection - ConnMgrEstablishConnection - Error 80070057 by Yaroslav

Yaroslav
Sat Jan 20 05:10:22 CST 2007

Is this a GUID of your VPN connection? In this function you should use a
GUID of the destination network, not a GUID of the connection. If your VPN
connection connects you to "My Work Network" (default case) , use
IID_DestNetCorp as ConnInfo.guidDestNet.

--
Yaroslav Goncharov
Pocket PC Developer Network coordinator, http://pocketpcdn.com
Spb Software House, http://spbsoftwarehouse.com


"Phani" <phani.dv@gmail.com> wrote in message
news:1169128748.229066.162780@l53g2000cwa.googlegroups.com...
> 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
>



Re: VPN Connection - ConnMgrEstablishConnection - Error 80070057 by Phani

Phani
Sun Jan 21 05:31:44 CST 2007

Hi,
I used all the available GUID's (Destinations), but again I am
getting the same error. One or more Invalid arguments.

I am unable to establish the VPN Connection.

what could be the problem?

let me give more info reg my app.

The device is trying to connect to VPN server in US, which is in India.


Please let me know if u have any solution.

thanks
Phani


Yaroslav Goncharov wrote:
> Is this a GUID of your VPN connection? In this function you should use a
> GUID of the destination network, not a GUID of the connection. If your VPN
> connection connects you to "My Work Network" (default case) , use
> IID_DestNetCorp as ConnInfo.guidDestNet.
>
> --
> Yaroslav Goncharov
> Pocket PC Developer Network coordinator, http://pocketpcdn.com
> Spb Software House, http://spbsoftwarehouse.com
>
>
> "Phani" <phani.dv@gmail.com> wrote in message
> news:1169128748.229066.162780@l53g2000cwa.googlegroups.com...
> > 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
> >


Re: VPN Connection - ConnMgrEstablishConnection - Error 80070057 by Yaroslav

Yaroslav
Sat Jan 27 11:09:12 CST 2007

Could you post your code snippet?

--
Yaroslav Goncharov
Pocket PC Developer Network coordinator, http://pocketpcdn.com
Spb Software House, http://spbsoftwarehouse.com


"Phani" <phani.dv@gmail.com> wrote in message
news:1169379104.418377.295970@q2g2000cwa.googlegroups.com...
> Hi,
> I used all the available GUID's (Destinations), but again I am
> getting the same error. One or more Invalid arguments.
>
> I am unable to establish the VPN Connection.
>
> what could be the problem?
>
> let me give more info reg my app.
>
> The device is trying to connect to VPN server in US, which is in India.
>
>
> Please let me know if u have any solution.
>
> thanks
> Phani
>
>
> Yaroslav Goncharov wrote:
>> Is this a GUID of your VPN connection? In this function you should use a
>> GUID of the destination network, not a GUID of the connection. If your
>> VPN
>> connection connects you to "My Work Network" (default case) , use
>> IID_DestNetCorp as ConnInfo.guidDestNet.
>>
>> --
>> Yaroslav Goncharov
>> Pocket PC Developer Network coordinator, http://pocketpcdn.com
>> Spb Software House, http://spbsoftwarehouse.com
>>
>>
>> "Phani" <phani.dv@gmail.com> wrote in message
>> news:1169128748.229066.162780@l53g2000cwa.googlegroups.com...
>> > 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
>> >
>