Unit FPRas

Renamed from RAS.pas 6/13/1998 Paul Rice to avoid conflicts with others' work. Unit: Remote Access Service (RAS) Creation: Feb 18, 1997. Translated from MS-Visual C 4.2 header files Copyright: François Piette This program can be used/modified freely provided this copyright notice remains here. If you like my code, find any bug or improve it, please feels free to let me know by sending an EMail at francois.piette@ping.be or francois.piette@f2202.n293.z2.fidonet.org * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Classes

Functions

RasConnectionStateToString - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
RasCreatePhonebookEntryA - function RasEntryDlgA( lpszPhonebook : PChar; // pointer to the full path and filename of the phone-book file lpszEntry : PChar; // pointer to the name of the phone-book entry to edit, copy, or create lpInfo : PRASENTRYDLG // pointer to a structure that contains additional parameters ) : DWORD; stdcall;

function RasEntryDlgA; external rasapi32 name 'RasEntryDlgA';
RasDialA - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
RasEditPhonebookEntryA - indicates whether the user's password was retrieved
RasEnumConnectionsA - buffer to receive status data
RasEnumEntriesA - number of connections written to buffer
RasGetConnectStatusA -
RasGetEntryDialParamsA - number of entries written to buffer
RasGetErrorStringA -
RasHangupA - size, in characters, of buffer

Types

PBOOL
PDWORD
PHRASCONN
PRASCONN
PRASCONNSTATUS
PRASDIALEXTENSIONS
PRASDIALPARAMS
PRASENTRYDLG
PRASENTRYNAME
THRASCONN
TRASCONN
TRASCONNSTATE
TRASCONNSTATUS
TRASDIALEXTENSIONS
TRASDIALPARAMS
TRASENTRYDLG
TRASENTRYNAME

Constants

CNLEN
DNLEN
PWLEN
rasapi32
RASCS_AllDevicesConnected
RASCS_AuthAck
RASCS_AuthCallback
RASCS_AuthChangePassword
RASCS_Authenticate
RASCS_Authenticated
RASCS_AuthLinkSpeed
RASCS_AuthNotify
RASCS_AuthProject
RASCS_AuthRetry
RASCS_CallbackComplete
RASCS_CallbackSetByCaller
RASCS_ConnectDevice
RASCS_Connected
RASCS_DeviceConnected
RASCS_Disconnected
RASCS_DONE
RASCS_Interactive
RASCS_LogonNetwork
RASCS_OpenPort
RASCS_PasswordExpired
RASCS_PAUSED
RASCS_PortOpened
RASCS_PrepareForCallback
RASCS_Projected
RASCS_ReAuthenticate
RASCS_RetryAuthentication
RASCS_StartAuthentication
RASCS_SubEntryConnected
RASCS_SubEntryDisconnected
RASCS_WaitForCallback
RASCS_WaitForModemReset
RASDIALEVENT
RAS_MaxAreaCode
RAS_MaxCallbackNumber
RAS_MaxDeviceName
RAS_MaxDeviceType
RAS_MaxEntryName
RAS_MaxFacilities
RAS_MaxIpAddress
RAS_MaxIpxAddress
RAS_MaxPadType
RAS_MaxPhoneNumber
RAS_MaxUserData
RAS_MaxX25Address
UNLEN
WM_RASDIALEVENT

Variables


Functions


function RasConnectionStateToString(nState : Integer) : String;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function RasCreatePhonebookEntryA( hWndParent : HWND; // handle to the parent window of the dialog box lpszPhonebook : PChar // pointer to the full path and filename of the phonebook file ) : DWORD;

function RasEntryDlgA( lpszPhonebook : PChar; // pointer to the full path and filename of the phone-book file lpszEntry : PChar; // pointer to the name of the phone-book entry to edit, copy, or create lpInfo : PRASENTRYDLG // pointer to a structure that contains additional parameters ) : DWORD; stdcall;

function RasEntryDlgA; external rasapi32 name 'RasEntryDlgA';


function RasDialA(RasDialExtensions: PRASDIALEXTENSIONS; PhoneBook : PChar; RasDialParams : PRASDIALPARAMS; NotifierType : DWORD; Notifier : Pointer; RasConn : PHRASCONN ): DWORD;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function RasEditPhonebookEntryA( hWndParent : HWND; // handle to the parent window of the dialog box lpszPhonebook : PChar; // pointer to the full path and filename of the phonebook file lpszEntryName : PChar // pointer to the phonebook entry name ) : DWORD;

indicates whether the user's password was retrieved

function RasEnumConnectionsA( pRasConn : PRASCONN; // buffer to receive connections data pCB : PDWORD; // size in bytes of buffer pcConnections : PDWORD // number of connections written to buffer ) : DWORD;

buffer to receive status data

function RasEnumEntriesA( Reserved : Pointer; // reserved, must be NIL szPhonebook : PChar; // full path and filename of phonebook file lpRasEntryName : PRASENTRYNAME; // buffer to receive entries lpcb : PDWORD; // size in bytes of buffer lpcEntries : PDWORD // number of entries written to buffer ) : DWORD;

number of connections written to buffer

function RasGetConnectStatusA( hRasConn: THRASCONN; // handle to RAS connection of interest lpRasConnStatus : PRASCONNSTATUS // buffer to receive status data ): DWORD;


function RasGetEntryDialParamsA( lpszPhonebook : PChar; // pointer to the full path and filename of the phonebook file lprasdialparams : PRASDIALPARAMS; // pointer to a structure that receives the connection parameters lpfPassword : PBOOL // indicates whether the user's password was retrieved ) : DWORD;

number of entries written to buffer

function RasGetErrorStringA( uErrorValue : DWORD; // error to get string for szErrorString : PChar; // buffer to hold error string cBufSize : DWORD // size, in characters, of buffer ): DWORD;


function RasHangupA(RasConn: THRASCONN): DWORD;

size, in characters, of buffer

Types


PBOOL         = ^BOOL

PDWORD        = ^DWORD

PHRASCONN     = ^THRASCONN

PRASCONN = ^TRASCONN

PRASCONNSTATUS = ^TRASCONNSTATUS

PRASDIALEXTENSIONS = ^TRASDIALEXTENSIONS

PRASDIALPARAMS = ^TRASDIALPARAMS

PRASENTRYDLG = ^TRASENTRYDLG

PRASENTRYNAME = ^TRASENTRYNAME

THRASCONN     = THandle

TRASCONN = record
dwSize : DWORD;
hRasConn : THRASCONN;
szEntryName : array [0..RAS_MaxEntryName] of char;
szDeviceType : array [0..RAS_MaxDeviceType] of char;
szDeviceName : array [0..RAS_MaxDeviceName] of char;
szPadding : array [0..0] of Char;
end;

TRASCONNSTATE = DWORD

TRASCONNSTATUS = record
dwSize : DWORD;
RasConnState : TRASCONNSTATE;
dwError : DWORD;
szDeviceType : array [0..RAS_MaxDeviceType] of char;
szDeviceName : array [0..RAS_MaxDeviceName] of char;
szPadding : array [0..1] of Char;
end;

TRASDIALEXTENSIONS = record
dwSize : DWORD;
dwfOptions : DWORD;
hwndParent : HWND;
reserved : DWORD;
end;

TRASDIALPARAMS = record
dwSize : DWORD;
szEntryName : array [0..RAS_MaxEntryName] of Char;
szPhoneNumber : array [0..RAS_MaxPhoneNumber] of Char;
szCallbackNumber : array [0..RAS_MaxCallbackNumber] of Char;
szUserName : array [0..UNLEN] of Char;
szPassword : array [0..PWLEN] of Char;
szDomain : array [0..DNLEN] of Char;
szPadding : array [0..2] of Char;
end;

TRASENTRYDLG = record
dwSize : DWORD;
hWndOwner : HWND;
dwFlags : DWORD;
xDlg : LongInt;
yDlg : LongInt;
szEntry : array [0..RAS_MaxEntryName] of char;
dwError : DWORD;
Reserved : DWORD;
Reserved2 : DWORD;
szPadding : array [0..2] of Char;
end;

TRASENTRYNAME = record
dwSize : DWORD;
szEntryName : array [0..RAS_MaxEntryName] of char;
szPadding : array [0..2] of Char;
end;

Constants

CNLEN = 15

Maximum password length

DNLEN = CNLEN

Computer name length

PWLEN = 256

Maximum user name length

rasapi32 = 'rasapi32.dll'

RASCS_AllDevicesConnected = 4

RASCS_AuthAck = 12

RASCS_AuthCallback = 8

RASCS_AuthChangePassword = 9

RASCS_Authenticate = 5

RASCS_Authenticated = 14

RASCS_AuthLinkSpeed = 11

RASCS_AuthNotify = 6

RASCS_AuthProject = 10

RASCS_AuthRetry = 7

RASCS_CallbackComplete = 20

RASCS_CallbackSetByCaller = (RASCS_PAUSED + 2)

RASCS_ConnectDevice = 2

RASCS_Connected = RASCS_DONE

RASCS_DeviceConnected = 3

RASCS_Disconnected = (RASCS_DONE + 1)

RASCS_DONE = $2000

RASCS_Interactive = RASCS_PAUSED

RASCS_LogonNetwork = 21

RASCS_OpenPort = 0

RASCS_PasswordExpired = (RASCS_PAUSED + 3)

RASCS_PAUSED = $1000

RASCS_PortOpened = 1

RASCS_PrepareForCallback = 15

RASCS_Projected = 18

RASCS_ReAuthenticate = 13

RASCS_RetryAuthentication = (RASCS_PAUSED + 1)

RASCS_StartAuthentication = 19

RASCS_SubEntryConnected = 22

RASCS_SubEntryDisconnected = 23

RASCS_WaitForCallback = 17

RASCS_WaitForModemReset = 16

RASDIALEVENT = 'RasDialEvent'

If using RasDial message notifications, get the notification message code by passing this string to the RegisterWindowMessageA() API. WM_RASDIALEVENT is used only if a unique message cannot be registered.

RAS_MaxAreaCode = 10

RAS_MaxCallbackNumber = RAS_MaxPhoneNumber

RAS_MaxDeviceName = 128

RAS_MaxDeviceType = 16

Maximum domain name length

RAS_MaxEntryName = 256

RAS_MaxFacilities = 200

RAS_MaxIpAddress = 15

RAS_MaxIpxAddress = 21

RAS_MaxPadType = 32

RAS_MaxPhoneNumber = 128

RAS_MaxUserData = 200

RAS_MaxX25Address = 200

UNLEN = 256

WM_RASDIALEVENT = $CCCD


Variables