This commit is contained in:
2024-08-07 09:16:27 -04:00
parent fdfadd5c7e
commit 5f971cf684
5200 changed files with 731717 additions and 0 deletions

18
rasapi/CONNSTAT.CPP Normal file
View File

@@ -0,0 +1,18 @@
#include <rasapi/connstat.hpp>
void RasConnectionStatus::deviceName(String deviceName)
{
::memset(tagRASCONNSTATUSA::szDeviceName,0,sizeof(tagRASCONNSTATUSA::szDeviceName));
if(deviceName.isNull())return;
if(deviceName.length()>RAS_MaxDeviceName)deviceName.length(RAS_MaxDeviceName);
::memcpy(tagRASCONNSTATUSA::szDeviceName,(LPSTR)deviceName,deviceName.length());
}
void RasConnectionStatus::deviceType(String deviceType)
{
::memset(tagRASCONNSTATUSA::szDeviceType,0,sizeof(tagRASCONNSTATUSA::szDeviceType));
if(deviceType.isNull())return;
if(deviceType.length()>RAS_MaxDeviceType)deviceType.length(RAS_MaxDeviceType);
::memcpy(tagRASCONNSTATUSA::szDeviceType,(LPSTR)deviceType,deviceType.length());
}

129
rasapi/CONNSTAT.HPP Normal file
View File

@@ -0,0 +1,129 @@
#ifndef _RASAPI_RASCONNSTATUS_HPP_
#define _RASAPI_RASCONNSTATUS_HPP_
#ifndef _RASAPI_RASCONNECTIONSTATE_HPP_
#include <rasapi/cstate.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
class RasConnectionStatus : private tagRASCONNSTATUSA
{
public:
RasConnectionStatus(void);
RasConnectionStatus(const RasConnectionStatus &someRasConnectionStatus);
RasConnectionStatus(const tagRASCONNSTATUSA &someRASCONNSTATUSA);
virtual ~RasConnectionStatus();
RasConnectionStatus &operator=(const RasConnectionStatus &someRasConnectionStatus);
RasConnectionStatus &operator=(const tagRASCONNSTATUSA &someRASCONNSTATUS);
WORD operator==(const RasConnectionStatus &someRasConnectionStatus)const;
RasConnectionState rasConnectionState(void)const;
void rasConnectionState(const RasConnectionState &someRasConnectionState);
DWORD error(void)const;
void error(DWORD error);
String deviceType(void)const;
void deviceType(String deviceType);
String deviceName(void)const;
void deviceName(String deviceName);
private:
void init(void);
};
inline
RasConnectionStatus::RasConnectionStatus(void)
{
init();
}
inline
RasConnectionStatus::RasConnectionStatus(const RasConnectionStatus &someRasConnectionStatus)
{
*this=someRasConnectionStatus;
}
inline
RasConnectionStatus::RasConnectionStatus(const tagRASCONNSTATUSA &someRASCONNSTATUSA)
{
*this=someRASCONNSTATUSA;
}
inline
RasConnectionStatus::~RasConnectionStatus()
{
}
inline
RasConnectionStatus &RasConnectionStatus::operator=(const RasConnectionStatus &someRasConnectionStatus)
{
init();
rasConnectionState(someRasConnectionStatus.rasConnectionState());
error(someRasConnectionStatus.error());
deviceType(someRasConnectionStatus.deviceType());
deviceName(someRasConnectionStatus.deviceName());
return *this;
}
inline
RasConnectionStatus &RasConnectionStatus::operator=(const tagRASCONNSTATUSA &someRASCONNSTATUS)
{
init();
rasConnectionState(RasConnectionState(someRASCONNSTATUS.rasconnstate));
error(someRASCONNSTATUS.dwError);
deviceType(someRASCONNSTATUS.szDeviceType);
deviceName(someRASCONNSTATUS.szDeviceName);
return *this;
}
inline
WORD RasConnectionStatus::operator==(const RasConnectionStatus &someRasConnectionStatus)const
{
return (rasConnectionState()==someRasConnectionStatus.rasConnectionState()&&
error()==someRasConnectionStatus.error()&&
deviceType()==someRasConnectionStatus.deviceType()&&
deviceName()==someRasConnectionStatus.deviceName());
}
inline
RasConnectionState RasConnectionStatus::rasConnectionState(void)const
{
return RasConnectionState(tagRASCONNSTATUSA::rasconnstate);
}
inline
void RasConnectionStatus::rasConnectionState(const RasConnectionState &someRasConnectionState)
{
tagRASCONNSTATUSA::rasconnstate=someRasConnectionState.connState();
}
inline
DWORD RasConnectionStatus::error(void)const
{
return tagRASCONNSTATUSA::dwError;
}
inline
void RasConnectionStatus::error(DWORD error)
{
tagRASCONNSTATUSA::dwError=error;
}
inline
String RasConnectionStatus::deviceType(void)const
{
return tagRASCONNSTATUSA::szDeviceType;
}
inline
String RasConnectionStatus::deviceName(void)const
{
return tagRASCONNSTATUSA::szDeviceName;
}
inline
void RasConnectionStatus::init(void)
{
::memset(&((tagRASCONNSTATUSA&)*this),0,sizeof(tagRASCONNSTATUSA));
tagRASCONNSTATUSA::dwSize=sizeof(tagRASCONNSTATUSA);
}
#endif

277
rasapi/CSTATE.HPP Normal file
View File

@@ -0,0 +1,277 @@
#ifndef _RASAPI_RASCONNECTIONSTATE_HPP_
#define _RASAPI_RASCONNECTIONSTATE_HPP_
#ifndef _COMMON_RAS_HPP_
#include <common/ras.hpp>
#endif
class RasConnectionState
{
public:
RasConnectionState(void);
RasConnectionState(RASCONNSTATE rasConnState);
RasConnectionState(const RasConnectionState &someRasConnectionState);
virtual ~RasConnectionState();
RasConnectionState &operator=(const RasConnectionState &someRasConnectionState);
WORD operator==(const RasConnectionState &someRasConnectionState);
RASCONNSTATE connState(void)const;
void connState(RASCONNSTATE rasConnState);
WORD openPort(void)const;
WORD portOpened(void)const;
WORD connectDevice(void)const;
WORD deviceConnected(void)const;
WORD allDevicesConnected(void)const;
WORD authenticate(void)const;
WORD authNotify(void)const;
WORD authRetry(void)const;
WORD authCallback(void)const;
WORD authChangePassword(void)const;
WORD authProject(void)const;
WORD authLinkSpeed(void)const;
WORD authAck(void)const;
WORD reAuthenticate(void)const;
WORD authenticated(void)const;
WORD prepareForCallback(void)const;
WORD waitForModemReset(void)const;
WORD waitForCallback(void)const;
WORD projected(void)const;
WORD startAuthentication(void)const;
WORD callbackComplete(void)const;
WORD logonNetwork(void)const;
WORD interactive(void)const;
WORD retryAuthentication(void)const;
WORD callbackSetByCaller(void)const;
WORD passwordExpired(void)const;
WORD connected(void)const;
WORD disconnected(void)const;
private:
RASCONNSTATE mRasConnState;
};
inline
RasConnectionState::RasConnectionState(void)
: mRasConnState((RASCONNSTATE)0)
{
}
inline
RasConnectionState::RasConnectionState(RASCONNSTATE rasConnState)
: mRasConnState(rasConnState)
{
}
inline
RasConnectionState::RasConnectionState(const RasConnectionState &someRasConnectionState)
{
*this=someRasConnectionState;
}
inline
RasConnectionState::~RasConnectionState()
{
}
inline
RasConnectionState &RasConnectionState::operator=(const RasConnectionState &someRasConnectionState)
{
mRasConnState=someRasConnectionState.mRasConnState;
return *this;
}
inline
WORD RasConnectionState::operator==(const RasConnectionState &someRasConnectionState)
{
return mRasConnState==someRasConnectionState.mRasConnState;
}
inline
WORD RasConnectionState::openPort(void)const
{
return mRasConnState==RASCS_OpenPort;
}
inline
WORD RasConnectionState::portOpened(void)const
{
return mRasConnState==RASCS_PortOpened;
}
inline
WORD RasConnectionState::connectDevice(void)const
{
return mRasConnState==RASCS_ConnectDevice;
}
inline
WORD RasConnectionState::deviceConnected(void)const
{
return mRasConnState==RASCS_DeviceConnected;
}
inline
WORD RasConnectionState::allDevicesConnected(void)const
{
return mRasConnState==RASCS_AllDevicesConnected;
}
inline
WORD RasConnectionState::authenticate(void)const
{
return mRasConnState==RASCS_Authenticate;
}
inline
WORD RasConnectionState::authNotify(void)const
{
return mRasConnState==RASCS_AuthNotify;
}
inline
WORD RasConnectionState::authRetry(void)const
{
return mRasConnState==RASCS_AuthRetry;
}
inline
WORD RasConnectionState::authCallback(void)const
{
return mRasConnState==RASCS_AuthCallback;
}
inline
WORD RasConnectionState::authChangePassword(void)const
{
return mRasConnState==RASCS_AuthChangePassword;
}
inline
WORD RasConnectionState::authProject(void)const
{
return mRasConnState==RASCS_AuthProject;
}
inline
WORD RasConnectionState::authLinkSpeed(void)const
{
return mRasConnState==RASCS_AuthLinkSpeed;
}
inline
WORD RasConnectionState::authAck(void)const
{
return mRasConnState==RASCS_AuthAck;
}
inline
WORD RasConnectionState::reAuthenticate(void)const
{
return mRasConnState==RASCS_ReAuthenticate;
}
inline
WORD RasConnectionState::authenticated(void)const
{
return mRasConnState==RASCS_Authenticated;
}
inline
WORD RasConnectionState::prepareForCallback(void)const
{
return mRasConnState==RASCS_PrepareForCallback;
}
inline
WORD RasConnectionState::waitForModemReset(void)const
{
return mRasConnState==RASCS_WaitForModemReset;
}
inline
WORD RasConnectionState::waitForCallback(void)const
{
return mRasConnState==RASCS_WaitForCallback;
}
inline
WORD RasConnectionState::projected(void)const
{
return mRasConnState==RASCS_Projected;
}
inline
WORD RasConnectionState::startAuthentication(void)const
{
#if (WINVER>=0x400)
return mRasConnState==RASCS_StartAuthentication;
#else
return FALSE;
#endif
}
inline
WORD RasConnectionState::callbackComplete(void)const
{
#if (WINVER>=0x400)
return mRasConnState==RASCS_CallbackComplete;
#else
return FALSE;
#endif
}
inline
WORD RasConnectionState::logonNetwork(void)const
{
#if (WINVER>=0x400)
return mRasConnState==RASCS_LogonNetwork;
#else
return FALSE;
#endif
}
inline
WORD RasConnectionState::interactive(void)const
{
return mRasConnState==RASCS_Interactive;
}
inline
WORD RasConnectionState::retryAuthentication(void)const
{
return mRasConnState==RASCS_RetryAuthentication;
}
inline
WORD RasConnectionState::callbackSetByCaller(void)const
{
return mRasConnState==RASCS_CallbackSetByCaller;
}
inline
WORD RasConnectionState::passwordExpired(void)const
{
return mRasConnState==RASCS_PasswordExpired;
}
inline
WORD RasConnectionState::connected(void)const
{
return mRasConnState==RASCS_Connected;
}
inline
WORD RasConnectionState::disconnected(void)const
{
return mRasConnState==RASCS_Disconnected;
}
inline
RASCONNSTATE RasConnectionState::connState(void)const
{
return mRasConnState;
}
inline
void RasConnectionState::connState(RASCONNSTATE rasConnState)
{
mRasConnState=rasConnState;
}
#endif

174
rasapi/Dialparm.hpp Normal file
View File

@@ -0,0 +1,174 @@
#ifndef _RASAPI_RASDIALPARAMS_HPP_
#define _RASAPI_RASDIALPARAMS_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _COMMON_RAS_HPP_
#include <common/ras.hpp>
#endif
class RasDialParams : private tagRASDIALPARAMSA
{
public:
RasDialParams(void);
RasDialParams(const RasDialParams &someRasDialParams);
virtual ~RasDialParams();
RasDialParams &operator=(const RasDialParams &someRasDialParams);
WORD operator==(const RasDialParams &someRasDialParams);
String entryName(void)const;
void entryName(String entryName);
String phoneNumber(void)const;
void phoneNumber(String phoneNumber);
String callbackNumber(void)const;
void callbackNumber(String callbackNumber);
String userName(void)const;
void userName(String userName);
String password(void)const;
void password(String password);
String domain(void)const;
void domain(String domain);
private:
void setZero(void);
};
inline
RasDialParams::RasDialParams(void)
{
tagRASDIALPARAMSA::dwSize=sizeof(tagRASDIALPARAMSA);
}
inline
RasDialParams::RasDialParams(const RasDialParams &someRasDialParams)
{
*this=someRasDialParams;
}
inline
RasDialParams::~RasDialParams()
{
}
inline
RasDialParams &RasDialParams::operator=(const RasDialParams &someRasDialParams)
{
tagRASDIALPARAMSA::dwSize=sizeof(tagRASDIALPARAMSA);
entryName(someRasDialParams.entryName());
phoneNumber(someRasDialParams.phoneNumber());
callbackNumber(someRasDialParams.callbackNumber());
userName(someRasDialParams.userName());
password(someRasDialParams.password());
domain(someRasDialParams.domain());
return *this;
}
inline
WORD RasDialParams::operator==(const RasDialParams &someRasDialParams)
{
return (entryName()==someRasDialParams.entryName()&&
phoneNumber()==someRasDialParams.phoneNumber()&&
callbackNumber()==someRasDialParams.callbackNumber()&&
userName()==someRasDialParams.userName()&&
password()==someRasDialParams.password()&&
domain()==someRasDialParams.domain());
}
inline
String RasDialParams::entryName(void)const
{
return tagRASDIALPARAMSA::szEntryName;
}
inline
void RasDialParams::entryName(String entryName)
{
::memset(tagRASDIALPARAMSA::szEntryName,0,sizeof(tagRASDIALPARAMSA::szEntryName));
if(entryName.isNull())return;
if(entryName.length()>RAS_MaxEntryName)entryName.length(RAS_MaxEntryName);
::memcpy(tagRASDIALPARAMSA::szEntryName,(LPSTR)entryName,entryName.length());
}
inline
String RasDialParams::phoneNumber(void)const
{
return tagRASDIALPARAMSA::szPhoneNumber;
}
inline
void RasDialParams::phoneNumber(String phoneNumber)
{
::memset(tagRASDIALPARAMSA::szPhoneNumber,0,sizeof(tagRASDIALPARAMSA::szPhoneNumber));
if(phoneNumber.isNull())return;
if(phoneNumber.length()>RAS_MaxPhoneNumber)phoneNumber.length(RAS_MaxPhoneNumber);
::memcpy(tagRASDIALPARAMSA::szPhoneNumber,(LPSTR)phoneNumber,phoneNumber.length());
}
inline
String RasDialParams::callbackNumber(void)const
{
return tagRASDIALPARAMSA::szCallbackNumber;
}
inline
void RasDialParams::callbackNumber(String callbackNumber)
{
::memset(tagRASDIALPARAMSA::szCallbackNumber,0,sizeof(tagRASDIALPARAMSA::szCallbackNumber));
if(callbackNumber.isNull())return;
if(callbackNumber.length()>RAS_MaxCallbackNumber)callbackNumber.length(RAS_MaxCallbackNumber);
::memcpy(tagRASDIALPARAMSA::szCallbackNumber,(LPSTR)callbackNumber,callbackNumber.length());
}
inline
String RasDialParams::userName(void)const
{
return tagRASDIALPARAMSA::szUserName;
}
inline
void RasDialParams::userName(String userName)
{
::memset(tagRASDIALPARAMSA::szUserName,0,sizeof(tagRASDIALPARAMSA::szUserName));
if(userName.isNull())return;
if(userName.length()>UNLEN)userName.length(UNLEN);
::memcpy(tagRASDIALPARAMSA::szUserName,(LPSTR)userName,userName.length());
}
inline
String RasDialParams::password(void)const
{
return tagRASDIALPARAMSA::szPassword;
}
inline
void RasDialParams::password(String password)
{
::memset(tagRASDIALPARAMSA::szPassword,0,sizeof(tagRASDIALPARAMSA::szPassword));
if(password.isNull())return;
if(password.length()>UNLEN)password.length(UNLEN);
::memcpy(tagRASDIALPARAMSA::szPassword,(LPSTR)password,password.length());
}
inline
String RasDialParams::domain(void)const
{
return tagRASDIALPARAMSA::szDomain;
}
inline
void RasDialParams::domain(String domain)
{
::memset(tagRASDIALPARAMSA::szDomain,0,sizeof(tagRASDIALPARAMSA::szDomain));
if(domain.isNull())return;
if(domain.length()>UNLEN)domain.length(UNLEN);
::memcpy(tagRASDIALPARAMSA::szDomain,(LPSTR)domain,domain.length());
}
inline
void RasDialParams::setZero(void)
{
::memset(&((tagRASDIALPARAMSA&)*this),0,sizeof(tagRASDIALPARAMSA));
}
#endif

42
rasapi/MAIN.CPP Normal file
View File

@@ -0,0 +1,42 @@
#include <rasapi/rasapi.hpp>
#include <rasapi/rassrv.hpp>
#include <rasapi/dialparm.hpp>
WORD findEntry(Block<RasEntryName> &rasEntryNames,RasEntryName &rasEntryName);
int PASCAL WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR /*lpszCmdLine*/,int /*nCmdShow*/)
{
RemoteAccessServer remoteServerInterface;
RasConnectionStatus rasConnectionStatus;
RasConnectionState rasConnectionState;
RasDialParams rasDialParams;
Block<RasEntryName> entryNames;
RasEntryName rasEntryName;
HRASCONN hRasConn(0);
if(!remoteServerInterface.isOkay())return FALSE;
remoteServerInterface.rasEnumEntries(entryNames);
if(!entryNames.size())return FALSE;
rasEntryName.entryName("Long Island Link");
if(!findEntry(entryNames,rasEntryName))return FALSE;
rasDialParams.entryName(rasEntryName.entryName());
rasDialParams.phoneNumber("");
rasDialParams.callbackNumber("");
rasDialParams.userName("sean");
rasDialParams.password("Cygnus");
rasDialParams.domain("");
if(remoteServerInterface.rasDial(0,0,&((tagRASDIALPARAMSA&)rasDialParams),0,0,&hRasConn))return FALSE;
remoteServerInterface.rasGetConnectStatus(hRasConn,rasConnectionStatus);
rasConnectionState=rasConnectionStatus.rasConnectionState();
if(!rasConnectionState.connected())::MessageBox(::GetFocus(),(LPSTR)"No connection.",(LPSTR)rasDialParams.entryName(),MB_OK);
remoteServerInterface.rasHangUp(hRasConn);
return FALSE;
}
WORD findEntry(Block<RasEntryName> &rasEntryNames,RasEntryName &rasEntryName)
{
for(short entryIndex=0;entryIndex<rasEntryNames.size();entryIndex++)
if(rasEntryNames[entryIndex].entryName()==rasEntryName.entryName())return TRUE;
return FALSE;
}

207
rasapi/RASAPI.BAK Normal file
View File

@@ -0,0 +1,207 @@
#ifndef _RASAPI_RASAPI_HPP_
#define _RASAPI_RASAPI_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_RAS_HPP_
#include <common/ras.hpp>
#endif
class RasApi
{
public:
RasApi(void);
RasApi(const RasApi &someRasApi);
virtual ~RasApi();
RasApi &operator=(const RasApi &someRasApi);
DWORD rasDial(LPRASDIALEXTENSIONS lpRasDialExtensions,LPTSTR lpszPhonebook,LPRASDIALPARAMS lpRasDialParams,DWORD dwNotifierType,LPVOID lpvNotifier,LPHRASCONN lphRasConn);
DWORD rasEnumConnections(LPRASCONN lprasconn,LPDWORD lpcb,LPDWORD lpcConnections);
DWORD rasEnumEntries(LPTSTR reserved,LPTSTR lpszPhonebook,LPRASENTRYNAME lprasentryname,LPDWORD lpcb,LPDWORD lpcEntries);
DWORD rasGetConnectStatus(HRASCONN hrasconn,LPRASCONNSTATUS lprasconnstatus);
DWORD rasGetErrorString(UINT uErrorValue,LPTSTR lpszErrorString,DWORD cBufSize);
DWORD rasHangUp(HRASCONN hrasconn);
DWORD rasGetProjectionInfo(HRASCONN hrasconn,RASPROJECTION rasprojection,LPVOID lpprojection,LPDWORD lpcb);
DWORD rasCreatePhonebookEntry(HWND hwnd,LPSTR lpszPhonebook);
DWORD rasEditPhonebookEntry(HWND hwnd,LPSTR lpszPhonebook,LPSTR lpszEntryName);
DWORD rasSetEntryDialParams(LPSTR lpszPhonebook,LPRASDIALPARAMS lprasdialparams,BOOL fRemovePassword);
DWORD rasGetEntryDialParams(LPTSTR lpszPhonebook,LPRASDIALPARAMS lprasdialparams,LPBOOL lpfPassword);
WORD isOkay(void)const;
private:
typedef DWORD (APIENTRY *LPFNRASDIAL)(LPRASDIALEXTENSIONS,LPSTR,LPRASDIALPARAMSA,DWORD,LPVOID,LPHRASCONN);
typedef DWORD (APIENTRY *LPFNRASENUMCONNECTIONS)(LPRASCONNA,LPDWORD,LPDWORD);
typedef DWORD (APIENTRY *LPFNRASENUMENTRIES)(LPSTR,LPSTR,LPRASENTRYNAMEA,LPDWORD,LPDWORD);
typedef DWORD (APIENTRY *LPFNRASGETCONNECTSTATUS)(HRASCONN,LPRASCONNSTATUSA);
typedef DWORD (APIENTRY *LPFNRASGETERRORSTRING)(UINT,LPSTR,DWORD);
typedef DWORD (APIENTRY *LPFNRASHANGUP)(HRASCONN);
typedef DWORD (APIENTRY *LPFNRASGETPROJECTIONINFO)(HRASCONN,RASPROJECTION,LPVOID,LPDWORD);
typedef DWORD (APIENTRY *LPFNRASCREATEPHONEBOOKENTRY)(HWND,LPSTR);
typedef DWORD (APIENTRY *LPFNRASEDITPHONEBOOKENTRY)(HWND,LPSTR,LPSTR);
typedef DWORD (APIENTRY *LPFNRASSETENTRYDIALPARAMS)(LPSTR,LPRASDIALPARAMSA,BOOL);
typedef DWORD (APIENTRY *LPFNRASGETENTRYDIALPARAMS)(LPSTR,LPRASDIALPARAMSA,LPBOOL);
void loadRasLib(void);
void freeRasLib(void);
void getEntryPoints(void);
HINSTANCE mhRasLib;
LPFNRASDIAL mlpfnRasDial;
LPFNRASENUMCONNECTIONS mlpfnRasEnumConnections;
LPFNRASENUMENTRIES mlpfnRasEnumEntries;
LPFNRASGETCONNECTSTATUS mlpfnRasGetConnectStatus;
LPFNRASGETERRORSTRING mlpfnRasGetErrorString;
LPFNRASHANGUP mlpfnRasHangup;
LPFNRASGETPROJECTIONINFO mlpfnRasGetProjectionInfo;
LPFNRASCREATEPHONEBOOKENTRY mlpfnRasCreatePhonebookEntry;
LPFNRASEDITPHONEBOOKENTRY mlpfnRasEditPhonebookEntry;
LPFNRASSETENTRYDIALPARAMS mlpfnRasSetEntryDialParams;
LPFNRASGETENTRYDIALPARAMS mlpfnRasGetEntryDialParams;
};
inline
RasApi::RasApi(void)
: mhRasLib(0), mlpfnRasDial(0), mlpfnRasEnumConnections(0), mlpfnRasEnumEntries(0),
mlpfnRasGetConnectStatus(0), mlpfnRasGetErrorString(0), mlpfnRasHangup(0),
mlpfnRasGetProjectionInfo(0), mlpfnRasCreatePhonebookEntry(0),
mlpfnRasEditPhonebookEntry(0), mlpfnRasSetEntryDialParams(0),
mlpfnRasGetEntryDialParams(0)
{
loadRasLib();
getEntryPoints();
}
inline
RasApi::RasApi(const RasApi &someRasApi)
{
*this=someRasApi;
}
inline
RasApi::~RasApi()
{
freeRasLib();
}
inline
RasApi &RasApi::operator=(const RasApi &/*someRasApi*/)
{
loadRasLib();
getEntryPoints();
return *this;
}
inline
void RasApi::loadRasLib(void)
{
freeRasLib();
mhRasLib=::LoadLibrary("RASAPI32");
if(!mhRasLib)return;
}
inline
void RasApi::freeRasLib(void)
{
if(!mhRasLib)return;
::FreeLibrary(mhRasLib);
mhRasLib=0;
}
inline
void RasApi::getEntryPoints(void)
{
if(!mhRasLib)return;
mlpfnRasDial=(LPFNRASDIAL)::GetProcAddress(mhRasLib,"RasDialA");
mlpfnRasEnumConnections=(LPFNRASENUMCONNECTIONS)::GetProcAddress(mhRasLib,"RasEnumConnectionsA");
mlpfnRasEnumEntries=(LPFNRASENUMENTRIES)::GetProcAddress(mhRasLib,"RasEnumEntriesA");
mlpfnRasGetConnectStatus=(LPFNRASGETCONNECTSTATUS)::GetProcAddress(mhRasLib,"RasGetConnectStatusA");
mlpfnRasGetErrorString=(LPFNRASGETERRORSTRING)::GetProcAddress(mhRasLib,"RasGetErrorStringA");
mlpfnRasHangup=(LPFNRASHANGUP)::GetProcAddress(mhRasLib,"RasHangUpA");
mlpfnRasGetProjectionInfo=(LPFNRASGETPROJECTIONINFO)::GetProcAddress(mhRasLib,"RasGetProjectionInfoA");
mlpfnRasCreatePhonebookEntry=(LPFNRASCREATEPHONEBOOKENTRY)::GetProcAddress(mhRasLib,"RasCreatePhonebookEntryA");
mlpfnRasEditPhonebookEntry=(LPFNRASEDITPHONEBOOKENTRY)::GetProcAddress(mhRasLib,"RasEditPhonebookEntryA");
mlpfnRasSetEntryDialParams=(LPFNRASSETENTRYDIALPARAMS)::GetProcAddress(mhRasLib,"RasSetEntryDialParamsA");
mlpfnRasGetEntryDialParams=(LPFNRASGETENTRYDIALPARAMS)::GetProcAddress(mhRasLib,"RasGetEntryDialParamsA");
}
inline
DWORD RasApi::rasDial(LPRASDIALEXTENSIONS lpRasDialExtensions,LPTSTR lpszPhonebook,LPRASDIALPARAMS lpRasDialParams,DWORD dwNotifierType,LPVOID lpvNotifier,LPHRASCONN lphRasConn)
{
if(!mlpfnRasDial)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasDial(lpRasDialExtensions,lpszPhonebook,lpRasDialParams,dwNotifierType,lpvNotifier,lphRasConn);
}
inline
DWORD RasApi::rasEnumConnections(LPRASCONN lprasconn,LPDWORD lpcb,LPDWORD lpcConnections)
{
if(!mlpfnRasEnumConnections)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasEnumConnections(lprasconn,lpcb,lpcConnections);
}
inline
DWORD RasApi::rasEnumEntries(LPTSTR reserved,LPTSTR lpszPhonebook,LPRASENTRYNAME lprasentryname,LPDWORD lpcb,LPDWORD lpcEntries)
{
if(!mlpfnRasEnumEntries)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasEnumEntries(reserved,lpszPhonebook,lprasentryname,lpcb,lpcEntries);
}
inline
DWORD RasApi::rasGetConnectStatus(HRASCONN hrasconn,LPRASCONNSTATUS lprasconnstatus)
{
if(!mlpfnRasGetConnectStatus)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasGetConnectStatus(hrasconn,lprasconnstatus);
}
inline
DWORD RasApi::rasGetErrorString(UINT uErrorValue,LPTSTR lpszErrorString,DWORD cBufSize)
{
if(!mlpfnRasGetErrorString)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasGetErrorString(uErrorValue,lpszErrorString,cBufSize);
}
inline
DWORD RasApi::rasHangUp(HRASCONN hrasconn)
{
if(!mlpfnRasHangup)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasHangup(hrasconn);
}
inline
DWORD RasApi::rasGetProjectionInfo(HRASCONN hrasconn,RASPROJECTION rasprojection,LPVOID lpprojection,LPDWORD lpcb)
{
if(!mlpfnRasGetProjectionInfo)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasGetProjectionInfo(hrasconn,rasprojection,lpprojection,lpcb);
}
inline
DWORD RasApi::rasCreatePhonebookEntry(HWND hwnd,LPSTR lpszPhonebook)
{
if(!mlpfnRasCreatePhonebookEntry)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasCreatePhonebookEntry(hwnd,lpszPhonebook);
}
inline
DWORD RasApi::rasEditPhonebookEntry(HWND hwnd,LPSTR lpszPhonebook,LPSTR lpszEntryName)
{
if(!mlpfnRasEditPhonebookEntry)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasEditPhonebookEntry(hwnd,lpszPhonebook,lpszEntryName);
}
inline
DWORD RasApi::rasSetEntryDialParams(LPSTR lpszPhonebook,LPRASDIALPARAMS lprasdialparams,BOOL fRemovePassword)
{
if(!mlpfnRasSetEntryDialParams)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasSetEntryDialParams(lpszPhonebook,lprasdialparams,fRemovePassword);
}
inline
DWORD RasApi::rasGetEntryDialParams(LPTSTR lpszPhonebook,LPRASDIALPARAMS lprasdialparams,LPBOOL lpfPassword)
{
if(!mlpfnRasGetEntryDialParams)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasGetEntryDialParams(lpszPhonebook,lprasdialparams,lpfPassword);
}
inline
WORD RasApi::isOkay(void)const
{
return (mhRasLib?TRUE:FALSE);
}
#endif

29
rasapi/RASAPI.DSW Normal file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "rasapi"=.\rasapi.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

207
rasapi/RASAPI.HPP Normal file
View File

@@ -0,0 +1,207 @@
#ifndef _RASAPI_RASAPI_HPP_
#define _RASAPI_RASAPI_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_RAS_HPP_
#include <common/ras.hpp>
#endif
class RasApi
{
public:
RasApi(void);
RasApi(const RasApi &someRasApi);
virtual ~RasApi();
RasApi &operator=(const RasApi &someRasApi);
DWORD rasDial(LPRASDIALEXTENSIONS lpRasDialExtensions,LPTSTR lpszPhonebook,LPRASDIALPARAMS lpRasDialParams,DWORD dwNotifierType,LPVOID lpvNotifier,LPHRASCONN lphRasConn);
DWORD rasEnumConnections(LPRASCONN lprasconn,LPDWORD lpcb,LPDWORD lpcConnections);
DWORD rasEnumEntries(LPTSTR reserved,LPTSTR lpszPhonebook,LPRASENTRYNAME lprasentryname,LPDWORD lpcb,LPDWORD lpcEntries);
DWORD rasGetConnectStatus(HRASCONN hrasconn,LPRASCONNSTATUS lprasconnstatus);
DWORD rasGetErrorString(UINT uErrorValue,LPTSTR lpszErrorString,DWORD cBufSize);
DWORD rasHangUp(HRASCONN hrasconn);
DWORD rasGetProjectionInfo(HRASCONN hrasconn,RASPROJECTION rasprojection,LPVOID lpprojection,LPDWORD lpcb);
DWORD rasCreatePhonebookEntry(HWND hwnd,LPSTR lpszPhonebook);
DWORD rasEditPhonebookEntry(HWND hwnd,LPSTR lpszPhonebook,LPSTR lpszEntryName);
DWORD rasSetEntryDialParams(LPSTR lpszPhonebook,LPRASDIALPARAMS lprasdialparams,BOOL fRemovePassword);
DWORD rasGetEntryDialParams(LPTSTR lpszPhonebook,LPRASDIALPARAMS lprasdialparams,LPBOOL lpfPassword);
WORD isOkay(void)const;
private:
typedef DWORD (APIENTRY *LPFNRASDIAL)(LPRASDIALEXTENSIONS,LPSTR,LPRASDIALPARAMSA,DWORD,LPVOID,LPHRASCONN);
typedef DWORD (APIENTRY *LPFNRASENUMCONNECTIONS)(LPRASCONNA,LPDWORD,LPDWORD);
typedef DWORD (APIENTRY *LPFNRASENUMENTRIES)(LPSTR,LPSTR,LPRASENTRYNAMEA,LPDWORD,LPDWORD);
typedef DWORD (APIENTRY *LPFNRASGETCONNECTSTATUS)(HRASCONN,LPRASCONNSTATUSA);
typedef DWORD (APIENTRY *LPFNRASGETERRORSTRING)(UINT,LPSTR,DWORD);
typedef DWORD (APIENTRY *LPFNRASHANGUP)(HRASCONN);
typedef DWORD (APIENTRY *LPFNRASGETPROJECTIONINFO)(HRASCONN,RASPROJECTION,LPVOID,LPDWORD);
typedef DWORD (APIENTRY *LPFNRASCREATEPHONEBOOKENTRY)(HWND,LPSTR);
typedef DWORD (APIENTRY *LPFNRASEDITPHONEBOOKENTRY)(HWND,LPSTR,LPSTR);
typedef DWORD (APIENTRY *LPFNRASSETENTRYDIALPARAMS)(LPSTR,LPRASDIALPARAMSA,BOOL);
typedef DWORD (APIENTRY *LPFNRASGETENTRYDIALPARAMS)(LPSTR,LPRASDIALPARAMSA,LPBOOL);
void loadRasLib(void);
void freeRasLib(void);
void getEntryPoints(void);
HINSTANCE mhRasLib;
LPFNRASDIAL mlpfnRasDial;
LPFNRASENUMCONNECTIONS mlpfnRasEnumConnections;
LPFNRASENUMENTRIES mlpfnRasEnumEntries;
LPFNRASGETCONNECTSTATUS mlpfnRasGetConnectStatus;
LPFNRASGETERRORSTRING mlpfnRasGetErrorString;
LPFNRASHANGUP mlpfnRasHangup;
LPFNRASGETPROJECTIONINFO mlpfnRasGetProjectionInfo;
LPFNRASCREATEPHONEBOOKENTRY mlpfnRasCreatePhonebookEntry;
LPFNRASEDITPHONEBOOKENTRY mlpfnRasEditPhonebookEntry;
LPFNRASSETENTRYDIALPARAMS mlpfnRasSetEntryDialParams;
LPFNRASGETENTRYDIALPARAMS mlpfnRasGetEntryDialParams;
};
inline
RasApi::RasApi(void)
: mhRasLib(0), mlpfnRasDial(0), mlpfnRasEnumConnections(0), mlpfnRasEnumEntries(0),
mlpfnRasGetConnectStatus(0), mlpfnRasGetErrorString(0), mlpfnRasHangup(0),
mlpfnRasGetProjectionInfo(0), mlpfnRasCreatePhonebookEntry(0),
mlpfnRasEditPhonebookEntry(0), mlpfnRasSetEntryDialParams(0),
mlpfnRasGetEntryDialParams(0)
{
loadRasLib();
getEntryPoints();
}
inline
RasApi::RasApi(const RasApi &someRasApi)
{
*this=someRasApi;
}
inline
RasApi::~RasApi()
{
freeRasLib();
}
inline
RasApi &RasApi::operator=(const RasApi &/*someRasApi*/)
{
loadRasLib();
getEntryPoints();
return *this;
}
inline
void RasApi::loadRasLib(void)
{
freeRasLib();
mhRasLib=::LoadLibrary("RASAPI32");
if(!mhRasLib)return;
}
inline
void RasApi::freeRasLib(void)
{
if(!mhRasLib)return;
::FreeLibrary(mhRasLib);
mhRasLib=0;
}
inline
void RasApi::getEntryPoints(void)
{
if(!mhRasLib)return;
mlpfnRasDial=(LPFNRASDIAL)::GetProcAddress(mhRasLib,"RasDialA");
mlpfnRasEnumConnections=(LPFNRASENUMCONNECTIONS)::GetProcAddress(mhRasLib,"RasEnumConnectionsA");
mlpfnRasEnumEntries=(LPFNRASENUMENTRIES)::GetProcAddress(mhRasLib,"RasEnumEntriesA");
mlpfnRasGetConnectStatus=(LPFNRASGETCONNECTSTATUS)::GetProcAddress(mhRasLib,"RasGetConnectStatusA");
mlpfnRasGetErrorString=(LPFNRASGETERRORSTRING)::GetProcAddress(mhRasLib,"RasGetErrorStringA");
mlpfnRasHangup=(LPFNRASHANGUP)::GetProcAddress(mhRasLib,"RasHangUpA");
mlpfnRasGetProjectionInfo=(LPFNRASGETPROJECTIONINFO)::GetProcAddress(mhRasLib,"RasGetProjectionInfoA");
mlpfnRasCreatePhonebookEntry=(LPFNRASCREATEPHONEBOOKENTRY)::GetProcAddress(mhRasLib,"RasCreatePhonebookEntryA");
mlpfnRasEditPhonebookEntry=(LPFNRASEDITPHONEBOOKENTRY)::GetProcAddress(mhRasLib,"RasEditPhonebookEntryA");
mlpfnRasSetEntryDialParams=(LPFNRASSETENTRYDIALPARAMS)::GetProcAddress(mhRasLib,"RasSetEntryDialParamsA");
mlpfnRasGetEntryDialParams=(LPFNRASGETENTRYDIALPARAMS)::GetProcAddress(mhRasLib,"RasGetEntryDialParamsA");
}
inline
DWORD RasApi::rasDial(LPRASDIALEXTENSIONS lpRasDialExtensions,LPTSTR lpszPhonebook,LPRASDIALPARAMS lpRasDialParams,DWORD dwNotifierType,LPVOID lpvNotifier,LPHRASCONN lphRasConn)
{
if(!mlpfnRasDial)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasDial(lpRasDialExtensions,lpszPhonebook,lpRasDialParams,dwNotifierType,lpvNotifier,lphRasConn);
}
inline
DWORD RasApi::rasEnumConnections(LPRASCONN lprasconn,LPDWORD lpcb,LPDWORD lpcConnections)
{
if(!mlpfnRasEnumConnections)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasEnumConnections(lprasconn,lpcb,lpcConnections);
}
inline
DWORD RasApi::rasEnumEntries(LPTSTR reserved,LPTSTR lpszPhonebook,LPRASENTRYNAME lprasentryname,LPDWORD lpcb,LPDWORD lpcEntries)
{
if(!mlpfnRasEnumEntries)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasEnumEntries(reserved,lpszPhonebook,lprasentryname,lpcb,lpcEntries);
}
inline
DWORD RasApi::rasGetConnectStatus(HRASCONN hrasconn,LPRASCONNSTATUS lprasconnstatus)
{
if(!mlpfnRasGetConnectStatus)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasGetConnectStatus(hrasconn,lprasconnstatus);
}
inline
DWORD RasApi::rasGetErrorString(UINT uErrorValue,LPTSTR lpszErrorString,DWORD cBufSize)
{
if(!mlpfnRasGetErrorString)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasGetErrorString(uErrorValue,lpszErrorString,cBufSize);
}
inline
DWORD RasApi::rasHangUp(HRASCONN hrasconn)
{
if(!mlpfnRasHangup)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasHangup(hrasconn);
}
inline
DWORD RasApi::rasGetProjectionInfo(HRASCONN hrasconn,RASPROJECTION rasprojection,LPVOID lpprojection,LPDWORD lpcb)
{
if(!mlpfnRasGetProjectionInfo)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasGetProjectionInfo(hrasconn,rasprojection,lpprojection,lpcb);
}
inline
DWORD RasApi::rasCreatePhonebookEntry(HWND hwnd,LPSTR lpszPhonebook)
{
if(!mlpfnRasCreatePhonebookEntry)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasCreatePhonebookEntry(hwnd,lpszPhonebook);
}
inline
DWORD RasApi::rasEditPhonebookEntry(HWND hwnd,LPSTR lpszPhonebook,LPSTR lpszEntryName)
{
if(!mlpfnRasEditPhonebookEntry)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasEditPhonebookEntry(hwnd,lpszPhonebook,lpszEntryName);
}
inline
DWORD RasApi::rasSetEntryDialParams(LPSTR lpszPhonebook,LPRASDIALPARAMS lprasdialparams,BOOL fRemovePassword)
{
if(!mlpfnRasSetEntryDialParams)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasSetEntryDialParams(lpszPhonebook,lprasdialparams,fRemovePassword);
}
inline
DWORD RasApi::rasGetEntryDialParams(LPTSTR lpszPhonebook,LPRASDIALPARAMS lprasdialparams,LPBOOL lpfPassword)
{
if(!mlpfnRasGetEntryDialParams)return ERROR_NOT_ENOUGH_MEMORY;
return mlpfnRasGetEntryDialParams(lpszPhonebook,lprasdialparams,lpfPassword);
}
inline
WORD RasApi::isOkay(void)const
{
return (mhRasLib?TRUE:FALSE);
}
#endif

BIN
rasapi/RASAPI.IDE Normal file

Binary file not shown.

29
rasapi/RASAPI.PLG Normal file
View File

@@ -0,0 +1,29 @@
--------------------Configuration: rasapi - Win32 Debug--------------------
Begining build with project "C:\WORK\RASAPI\rasapi.dsp", at root.
Active configuration is Win32 (x86) Static Library (based on Win32 (x86) Static Library)
Project's tools are:
"32-bit C/C++ Compiler for 80x86" with flags "/nologo /Zp1 /MTd /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__FLAT__" /D "STRICT" /Fp"..\exe\msvc42.pch" /YX"windows.h" /Fo".\msvcobj/" /Fd".\msvcobj/" /FD /c "
"Browser Database Maker" with flags "/nologo /o".\msvcobj/rasapi.bsc" "
"Library Manager" with flags "/nologo /out:"..\exe\msrasapi.lib" "
"Custom Build" with flags ""
"<Component 0xa>" with flags ""
Creating temp file "C:\WINDOWS\TEMP\RSP71A4.TMP" with contents </nologo /Zp1 /MTd /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__FLAT__" /D "STRICT" /Fp"..\exe\msvc42.pch" /YX"windows.h" /Fo".\msvcobj/" /Fd".\msvcobj/" /FD /c
"C:\WORK\RASAPI\Stdtmpl.cpp"
"C:\WORK\RASAPI\Rasentry.cpp"
"C:\WORK\RASAPI\Rassrv.cpp"
"C:\WORK\RASAPI\Connstat.cpp"
>
Creating command line "cl.exe @C:\WINDOWS\TEMP\RSP71A4.TMP"
Creating command line "link.exe -lib /nologo /out:"..\exe\msrasapi.lib" .\msvcobj\Stdtmpl.obj .\msvcobj\Rasentry.obj .\msvcobj\Rassrv.obj .\msvcobj\Connstat.obj"
Compiling...
Stdtmpl.cpp
Rasentry.cpp
Rassrv.cpp
Connstat.cpp
Creating library...
msrasapi.lib - 0 error(s), 0 warning(s)

11
rasapi/RASENTRY.CPP Normal file
View File

@@ -0,0 +1,11 @@
#include <rasapi/rasentry.hpp>
void RasEntryName::entryName(String entryName)
{
::memset(tagRASENTRYNAMEA::szEntryName,0,sizeof(tagRASENTRYNAMEA::szEntryName));
if(entryName.isNull())return;
if(entryName.length()>RAS_MaxEntryName)entryName.length(RAS_MaxEntryName);
::memcpy(tagRASENTRYNAMEA::szEntryName,(LPSTR)entryName,entryName.length());
}

80
rasapi/RASENTRY.HPP Normal file
View File

@@ -0,0 +1,80 @@
#ifndef _RASAPI_RASENTRYNAME_HPP_
#define _RASAPI_RASENTRYNAME_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _COMMON_RAS_HPP_
#include <common/ras.hpp>
#endif
class RasEntryName : private tagRASENTRYNAMEA
{
public:
RasEntryName(void);
RasEntryName(const RasEntryName &someRasEntryName);
RasEntryName(const tagRASENTRYNAMEA &someRASENTRYNAMEA);
virtual ~RasEntryName();
RasEntryName &operator=(const RasEntryName &someRasEntryName);
WORD operator==(const RasEntryName &someRasEntryName)const;
String entryName(void)const;
void entryName(String entryName);
private:
void setZero(void);
};
inline
RasEntryName::RasEntryName(void)
{
setZero();
tagRASENTRYNAMEA::dwSize=sizeof(tagRASENTRYNAMEA);
}
inline
RasEntryName::RasEntryName(const RasEntryName &someRasEntryName)
{
*this=someRasEntryName;
}
inline
RasEntryName::RasEntryName(const tagRASENTRYNAMEA &someRASENTRYNAMEA)
{
setZero();
tagRASENTRYNAMEA::dwSize=sizeof(tagRASENTRYNAMEA);
entryName(someRASENTRYNAMEA.szEntryName);
}
inline
RasEntryName::~RasEntryName()
{
}
inline
RasEntryName &RasEntryName::operator=(const RasEntryName &someRasEntryName)
{
tagRASENTRYNAMEA::dwSize=sizeof(tagRASENTRYNAMEA);
entryName(someRasEntryName.entryName());
return *this;
}
inline
WORD RasEntryName::operator==(const RasEntryName &someRasEntryName)const
{
return entryName()==someRasEntryName.entryName();
}
inline
String RasEntryName::entryName(void)const
{
return tagRASENTRYNAMEA::szEntryName;
}
inline
void RasEntryName::setZero(void)
{
::memset(tagRASENTRYNAMEA::szEntryName,0,sizeof(tagRASENTRYNAMEA::szEntryName));
}
#endif

BIN
rasapi/RASTST.DSW Normal file

Binary file not shown.

BIN
rasapi/RASTST.IDE Normal file

Binary file not shown.

126
rasapi/Rasapi.001 Normal file
View File

@@ -0,0 +1,126 @@
# Microsoft Developer Studio Project File - Name="rasapi" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=rasapi - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "rasapi.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "rasapi.mak" CFG="rasapi - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "rasapi - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "rasapi - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
!IF "$(CFG)" == "rasapi - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "rasapi - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\msvcobj"
# PROP Intermediate_Dir ".\msvcobj"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /Zp1 /MTd /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__FLAT__" /D "STRICT" /Fp"..\exe\msvc42.pch" /YX"windows.h" /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\exe\msrasapi.lib"
!ENDIF
# Begin Target
# Name "rasapi - Win32 Release"
# Name "rasapi - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\Connstat.cpp
# End Source File
# Begin Source File
SOURCE=.\Rasentry.cpp
# End Source File
# Begin Source File
SOURCE=.\Rassrv.cpp
# End Source File
# Begin Source File
SOURCE=.\Stdtmpl.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\Connstat.hpp
# End Source File
# Begin Source File
SOURCE=.\Cstate.hpp
# End Source File
# Begin Source File
SOURCE=.\Rasapi.hpp
# End Source File
# Begin Source File
SOURCE=.\Rasentry.hpp
# End Source File
# Begin Source File
SOURCE=.\Rassrv.hpp
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

132
rasapi/Rasapi.dsp Normal file
View File

@@ -0,0 +1,132 @@
# Microsoft Developer Studio Project File - Name="rasapi" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=rasapi - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Rasapi.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Rasapi.mak" CFG="rasapi - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "rasapi - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "rasapi - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "rasapi - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MT /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__FLAT__" /D "STRICT" /YX /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "rasapi - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\msvcobj"
# PROP Intermediate_Dir ".\msvcobj"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /Gz /MTd /Z7 /O2 /D "_DEBUG" /D "__FLAT__" /D "STRICT" /D "WIN32" /D "_WINDOWS" /Fp"..\exe\msvc42.pch" /YX"windows.h" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\exe\msrasapi.lib"
!ENDIF
# Begin Target
# Name "rasapi - Win32 Release"
# Name "rasapi - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\Connstat.cpp
# End Source File
# Begin Source File
SOURCE=.\Rasentry.cpp
# End Source File
# Begin Source File
SOURCE=.\Rassrv.cpp
# End Source File
# Begin Source File
SOURCE=.\Stdtmpl.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\Connstat.hpp
# End Source File
# Begin Source File
SOURCE=.\Cstate.hpp
# End Source File
# Begin Source File
SOURCE=.\Rasapi.hpp
# End Source File
# Begin Source File
SOURCE=.\Rasentry.hpp
# End Source File
# Begin Source File
SOURCE=.\Rassrv.hpp
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

296
rasapi/Rasapi.mak Normal file
View File

@@ -0,0 +1,296 @@
# Microsoft Developer Studio Generated NMAKE File, Based on rasapi.dsp
!IF "$(CFG)" == ""
CFG=rasapi - Win32 Release
!MESSAGE No configuration specified. Defaulting to rasapi - Win32 Release.
!ENDIF
!IF "$(CFG)" != "rasapi - Win32 Release" && "$(CFG)" != "rasapi - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "rasapi.mak" CFG="rasapi - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "rasapi - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "rasapi - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
CPP=cl.exe
!IF "$(CFG)" == "rasapi - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\.\Release
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\rasapi.lib"
!ELSE
ALL : "$(OUTDIR)\rasapi.lib"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\Connstat.obj"
-@erase "$(INTDIR)\Rasentry.obj"
-@erase "$(INTDIR)\Rassrv.obj"
-@erase "$(INTDIR)\Stdtmpl.obj"
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(OUTDIR)\rasapi.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)\rasapi.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Release/
CPP_SBRS=.
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\rasapi.bsc"
BSC32_SBRS= \
LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\rasapi.lib"
LIB32_OBJS= \
"$(INTDIR)\Connstat.obj" \
"$(INTDIR)\Rasentry.obj" \
"$(INTDIR)\Rassrv.obj" \
"$(INTDIR)\Stdtmpl.obj"
"$(OUTDIR)\rasapi.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ELSEIF "$(CFG)" == "rasapi - Win32 Debug"
OUTDIR=.\msvcobj
INTDIR=.\msvcobj
!IF "$(RECURSE)" == "0"
ALL : "..\exe\msrasapi.lib"
!ELSE
ALL : "..\exe\msrasapi.lib"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\Connstat.obj"
-@erase "$(INTDIR)\Rasentry.obj"
-@erase "$(INTDIR)\Rassrv.obj"
-@erase "$(INTDIR)\Stdtmpl.obj"
-@erase "$(INTDIR)\vc50.idb"
-@erase "..\exe\msrasapi.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /Zp1 /MTd /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D\
"__FLAT__" /D "STRICT" /Fp"..\exe\msvc42.pch" /YX"windows.h" /Fo"$(INTDIR)\\"\
/Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\msvcobj/
CPP_SBRS=.
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\rasapi.bsc"
BSC32_SBRS= \
LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"..\exe\msrasapi.lib"
LIB32_OBJS= \
"$(INTDIR)\Connstat.obj" \
"$(INTDIR)\Rasentry.obj" \
"$(INTDIR)\Rassrv.obj" \
"$(INTDIR)\Stdtmpl.obj"
"..\exe\msrasapi.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ENDIF
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
!IF "$(CFG)" == "rasapi - Win32 Release" || "$(CFG)" == "rasapi - Win32 Debug"
SOURCE=.\Connstat.cpp
!IF "$(CFG)" == "rasapi - Win32 Release"
DEP_CPP_CONNS=\
".\Connstat.hpp"\
".\Cstate.hpp"\
{$(INCLUDE)}"common\ras.hpp"\
{$(INCLUDE)}"common\stdlib.hpp"\
{$(INCLUDE)}"common\string.hpp"\
{$(INCLUDE)}"common\windows.hpp"\
"$(INTDIR)\Connstat.obj" : $(SOURCE) $(DEP_CPP_CONNS) "$(INTDIR)"
!ELSEIF "$(CFG)" == "rasapi - Win32 Debug"
DEP_CPP_CONNS=\
".\Connstat.hpp"\
".\Cstate.hpp"\
{$(INCLUDE)}"common\ras.hpp"\
{$(INCLUDE)}"common\stdlib.hpp"\
{$(INCLUDE)}"common\string.hpp"\
{$(INCLUDE)}"common\windows.hpp"\
"$(INTDIR)\Connstat.obj" : $(SOURCE) $(DEP_CPP_CONNS) "$(INTDIR)"
!ENDIF
SOURCE=.\Rasentry.cpp
!IF "$(CFG)" == "rasapi - Win32 Release"
DEP_CPP_RASEN=\
".\Rasentry.hpp"\
{$(INCLUDE)}"common\ras.hpp"\
{$(INCLUDE)}"common\stdlib.hpp"\
{$(INCLUDE)}"common\string.hpp"\
{$(INCLUDE)}"common\windows.hpp"\
"$(INTDIR)\Rasentry.obj" : $(SOURCE) $(DEP_CPP_RASEN) "$(INTDIR)"
!ELSEIF "$(CFG)" == "rasapi - Win32 Debug"
DEP_CPP_RASEN=\
".\Rasentry.hpp"\
{$(INCLUDE)}"common\ras.hpp"\
{$(INCLUDE)}"common\stdlib.hpp"\
{$(INCLUDE)}"common\string.hpp"\
{$(INCLUDE)}"common\windows.hpp"\
"$(INTDIR)\Rasentry.obj" : $(SOURCE) $(DEP_CPP_RASEN) "$(INTDIR)"
!ENDIF
SOURCE=.\Rassrv.cpp
!IF "$(CFG)" == "rasapi - Win32 Release"
DEP_CPP_RASSR=\
".\Connstat.hpp"\
".\Cstate.hpp"\
".\Rasapi.hpp"\
".\Rasentry.hpp"\
".\Rassrv.hpp"\
{$(INCLUDE)}"common\block.hpp"\
{$(INCLUDE)}"common\block.tpp"\
{$(INCLUDE)}"common\except.hpp"\
{$(INCLUDE)}"common\ras.hpp"\
{$(INCLUDE)}"common\stdlib.hpp"\
{$(INCLUDE)}"common\string.hpp"\
{$(INCLUDE)}"common\windows.hpp"\
"$(INTDIR)\Rassrv.obj" : $(SOURCE) $(DEP_CPP_RASSR) "$(INTDIR)"
!ELSEIF "$(CFG)" == "rasapi - Win32 Debug"
DEP_CPP_RASSR=\
".\Connstat.hpp"\
".\Cstate.hpp"\
".\Rasapi.hpp"\
".\Rasentry.hpp"\
".\Rassrv.hpp"\
{$(INCLUDE)}"common\block.hpp"\
{$(INCLUDE)}"common\block.tpp"\
{$(INCLUDE)}"common\except.hpp"\
{$(INCLUDE)}"common\ras.hpp"\
{$(INCLUDE)}"common\stdlib.hpp"\
{$(INCLUDE)}"common\string.hpp"\
{$(INCLUDE)}"common\windows.hpp"\
"$(INTDIR)\Rassrv.obj" : $(SOURCE) $(DEP_CPP_RASSR) "$(INTDIR)"
!ENDIF
SOURCE=.\Stdtmpl.cpp
!IF "$(CFG)" == "rasapi - Win32 Release"
DEP_CPP_STDTM=\
".\Rasentry.hpp"\
{$(INCLUDE)}"common\block.hpp"\
{$(INCLUDE)}"common\block.tpp"\
{$(INCLUDE)}"common\except.hpp"\
{$(INCLUDE)}"common\ras.hpp"\
{$(INCLUDE)}"common\stdlib.hpp"\
{$(INCLUDE)}"common\string.hpp"\
{$(INCLUDE)}"common\windows.hpp"\
"$(INTDIR)\Stdtmpl.obj" : $(SOURCE) $(DEP_CPP_STDTM) "$(INTDIR)"
!ELSEIF "$(CFG)" == "rasapi - Win32 Debug"
"$(INTDIR)\Stdtmpl.obj" : $(SOURCE) "$(INTDIR)"
!ENDIF
!ENDIF

34
rasapi/Rassrv.cpp Normal file
View File

@@ -0,0 +1,34 @@
#include <rasapi/rassrv.hpp>
WORD RemoteAccessServer::rasEnumEntries(Block<RasEntryName> &rasEntryNames)
{
tagRASENTRYNAMEA *lpEntryNames;
DWORD bytesNeeded(0);
DWORD entriesInBuff(0);
rasEntryNames.remove();
RasApi::rasEnumEntries(0,0,0,&bytesNeeded,&entriesInBuff);
if(!entriesInBuff)return rasEntryNames.size();
lpEntryNames=new tagRASENTRYNAMEA[bytesNeeded/sizeof(tagRASENTRYNAMEA)];
lpEntryNames[0].dwSize=sizeof(tagRASENTRYNAMEA);
RasApi::rasEnumEntries(0,0,lpEntryNames,&bytesNeeded,&entriesInBuff);
for(short entryIndex=0;entryIndex<entriesInBuff;entryIndex++)
{
RasEntryName rasEntryName;
rasEntryName.entryName(lpEntryNames[entryIndex].szEntryName);
rasEntryNames.insert(&rasEntryName);
}
delete[] lpEntryNames;
return rasEntryNames.size();
}
DWORD RemoteAccessServer::rasGetConnectStatus(HRASCONN hRasConn,RasConnectionStatus &someRasConnectionStatus)
{
DWORD returnCode;
RASCONNSTATUS rasConnStatus;
rasConnStatus.dwSize=sizeof(RASCONNSTATUS);
returnCode=RasApi::rasGetConnectStatus(hRasConn,&rasConnStatus);
someRasConnectionStatus=rasConnStatus;
return returnCode;
}

38
rasapi/Rassrv.hpp Normal file
View File

@@ -0,0 +1,38 @@
#ifndef _RASAPI_REMOTEACCESSSERVER_HPP_
#define _RASAPI_REMOTEACCESSSERVER_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_BLOCK_HPP_
#include <common/block.hpp>
#endif
#ifndef _RASAPI_RASAPI_HPP_
#include <rasapi/rasapi.hpp>
#endif
#ifndef _RASAPI_RASENTRYNAME_HPP_
#include <rasapi/rasentry.hpp>
#endif
#ifndef _RASAPI_RASCONNSTATUS_HPP_
#include <rasapi/connstat.hpp>
#endif
class RemoteAccessServer : public RasApi
{
public:
RemoteAccessServer(void);
virtual ~RemoteAccessServer();
WORD rasEnumEntries(Block<RasEntryName> &rasEntryNames);
DWORD rasGetConnectStatus(HRASCONN hRasConn,RasConnectionStatus &rasConnectionStatus);
private:
};
inline
RemoteAccessServer::RemoteAccessServer(void)
{
}
inline
RemoteAccessServer::~RemoteAccessServer()
{
}
#endif

23
rasapi/SCRAPS.TXT Normal file
View File

@@ -0,0 +1,23 @@
#if 0
typedef struct _RASDIALPARAMS
{
DWORD dwSize;
TCHAR szEntryName[RAS_MaxEntryName + 1];
TCHAR szPhoneNumber[RAS_MaxPhoneNumber + 1];
TCHAR szCallbackNumber[RAS_MaxCallbackNumber + 1];
TCHAR szUserName[UNLEN + 1];
TCHAR szPassword[PWLEN + 1];
TCHAR szDomain[DNLEN + 1] ;
} RASDIALPARAMS;
inline
RasInterface::~RasInterface()
{
mRemoteAccessServerInterface.rasHangup(mhRasConn);
// if(mRasConnectionState.connected())mRemoteServerInterface.rasHangUp(mhRasConn);
}

10
rasapi/STDTMPL.CPP Normal file
View File

@@ -0,0 +1,10 @@
#ifndef _MSC_VER
#define _EXPAND_BLOCK_TEMPLATES_
#include <common/block.hpp>
#include <common/block.tpp>
#include <common/string.hpp>
#include <rasapi/rasentry.hpp>
typedef Block<String> a;
typedef Block<RasEntryName> b;
#endif

BIN
rasapi/TDCONFIG.TDW Normal file

Binary file not shown.

BIN
rasapi/TDW.TRW Normal file

Binary file not shown.

BIN
rasapi/rasapi.mdp Normal file

Binary file not shown.