📄 rashelper.cpp
字号:
// RASHelper.cpp: implementation of the CRASHelper class.
//
//////////////////////////////////////////////////////////////////////
/*******************************************************************************
* *
* This file is part of VPNDialer. *
* *
* VPNDialer is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* VPNDialer is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with VPNDialer; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
* *
* Copyright (c) 2003 Evidian GmbH, written by Thomas Kriener *
* *
*******************************************************************************/
#include "stdafx.h"
#include "VPNDialer.h"
#include "RASHelper.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CRASHelper::CRASHelper()
:CUT_RAS()
{
}
CRASHelper::~CRASHelper()
{
}
CString CRASHelper::GetIPAddress()
{
RASCONN * pRasConn = NULL;
DWORD cb;
CString sIP_Address;
// we need the PPP Projection
RASPPPIP pppProjection;
pppProjection.dwSize = sizeof(RASPPPIP);
RasGetProjectionInfo(m_rasConn,RASP_PppIp,&pppProjection,&cb );
sIP_Address.Format("%s",pppProjection.szIpAddress );
return sIP_Address;
}
int CRASHelper::L2TPDial(LPCSTR szEntry, LPCSTR szUserName, LPCSTR szPassword, LPCSTR szNumber)
{
char userName[UNLEN];
char pass[PWLEN];
char number[RAS_MaxPhoneNumber];
if(szUserName==NULL)
{
GetEntryUserName(szEntry,userName,UNLEN-1);
}
else
{
strcpy(userName,szUserName);
}
if(szPassword==NULL)
{
GetEntryPassword(szEntry,pass,PWLEN-1);
}
else
{
strcpy(pass,szPassword);
}
if(szNumber==NULL)
{
GetEntryPhoneNumber(szEntry,number, RAS_MaxPhoneNumber-1,NULL,0);
}
else
{
strcpy(number,szNumber);
}
return Dial(szEntry,userName,pass,number);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -