⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ras_api32.pas

📁 DELIPHI编写的小程序
💻 PAS
📖 第 1 页 / 共 2 页
字号:
	//
	ipaddr,
	ipaddrDns,
	ipaddrDnsAlt,
	ipaddrWins,
	ipaddrWinsAlt: TRasIPAddr;
	//
	// Framing
	//
	dwFrameSize,
	dwfNetProtocols,
	dwFramingProtocol: Longint;
	//
	// Scripting
	//
	szScript: Array[0..MAX_PATH - 1] of Char;
	//
	// AutoDial
	//
	szAutodialDll: Array [0..MAX_PATH - 1] of Char;
	szAutodialFunc: Array [0..MAX_PATH - 1] of Char;
	//
	// Device
	//
	szDeviceType: Array [0..RAS_MaxDeviceType] of Char;
	szDeviceName: Array [0..RAS_MaxDeviceName] of Char;
	//
	// X.25
	//
	szX25PadType: Array [0..RAS_MaxPadType] of Char;
	szX25Address: Array [0..RAS_MaxX25Address] of Char;
	szX25Facilities: Array [0..RAS_MaxFacilities] of Char;
	szX25UserData: Array [0..RAS_MaxUserData] of Char;
	dwChannels: Longint;
	//
	// Reserved
	//
	dwReserved1,
	dwReserved2: Longint;
	//
	// Multilink
	//
{$IFDEF NT_EXTNS}
	dwSubEntries,
	dwDialMode,
	dwDialExtraPercent,
	dwDialExtraSampleSeconds,
	dwHangUpExtraPercent,
	dwHangUpExtraSampleSeconds: Longint;
	//
	// Idle timeout
	//
	dwIdleDisconnectSeconds: Longint;
{$ENDIF}
  end;

  PRasProjection = ^TRasProjection;
  TRasProjection = Integer;



const

// TRasEntry 'dwfOptions' bit flags.

  RASEO_UseCountryAndAreaCodes 	= $00000001;
  RASEO_SpecificIpAddr		 	= $00000002;
  RASEO_SpecificNameServers		= $00000004;
  RASEO_IpHeaderCompression		= $00000008;
  RASEO_RemoteDefaultGateway	= $00000010;
  RASEO_DisableLcpExtensions	= $00000020;
  RASEO_TerminalBeforeDial	 	= $00000040;
  RASEO_TerminalAfterDial	  	= $00000080;
  RASEO_ModemLights				= $00000100;
  RASEO_SwCompression		  	= $00000200;
  RASEO_RequireEncryptedPw	 	= $00000400;
  RASEO_RequireMsEncryptedPw	= $00000800;
  RASEO_RequireDataEncryption  	= $00001000;
  RASEO_NetworkLogon			= $00002000;
  RASEO_UseLogonCredentials		= $00004000;
  RASEO_PromoteAlternates	  	= $00008000;
  RASEO_SecureLocalFiles		= $00010000;

// TRasEntry 'dwfNetProtocols' bit flags. (session negotiated protocols)

  RASNP_Netbeui = $00000001;  // Negotiate NetBEUI
  RASNP_Ipx	 	= $00000002;  // Negotiate IPX
  RASNP_Ip	  	= $00000004;  // Negotiate TCP/IP

// TRasEntry 'dwFramingProtocols' (framing protocols used by the server)

  RASFP_Ppp  = $00000001;  // Point-to-Point Protocol (PPP)
  RASFP_Slip = $00000002;  // Serial Line Internet Protocol (SLIP)
  RASFP_Ras  = $00000004;  // Microsoft proprietary protocol

// TRasEntry 'szDeviceType' strings

  RASDT_Modem	= 'Modem';
  RASDT_Isdn  	= 'ISDN';
  RASDT_X25	= 'x25';
  RASDT_Vpn     = 'vpn' ;
  RASDT_Pad     = 'pad' ;


// Protocol code to projection data structure mapping.

// TRasProjection literals for RasGetProjectionInfo
  RASP_Amb 		= $10000 ;
  RASP_PppNbf 	= $803F ;
  RASP_PppIpx 	= $802B ;
  RASP_PppIp 	= $8021 ;
  RASP_PppLcp 	= $C021 ;
  RASP_Slip 	= $20000 ;


// following structures are NT4 only, some DUN 1.2

//Flags for RasConnectionNotification()

  RASCN_Connection       = $00000001;
  RASCN_Disconnection    = $00000002;
  RASCN_BandwidthAdded   = $00000004;
  RASCN_BandwidthRemoved = $00000008;

// TRasEntry 'dwDialMode' values.

  RASEDM_DialAll      = 1;
  RASEDM_DialAsNeeded = 2;

// TRasEntry 'dwIdleDisconnectSeconds' constants

  RASIDS_Disabled       = $ffffffff;
  RASIDS_UseGlobalValue = 0;

type

// AutoDial DLL function parameter block

  LpRasADParams = ^TRasADParams;
  TRasADParams = record
    dwSize: Longint;
    hwndOwner: THandle;
    dwFlags: Longint;
    xDlg,
    yDlg: Longint;
  end;

const

// AutoDial DLL function parameter block 'dwFlags.'

  RASADFLG_PositionDlg = $00000001;

// A RAS phone book multilinked sub-entry - NT4 only

{$IFDEF NT_EXTNS}

type

  LpRasSubEntry = ^TRasSubEntry;
  TRasSubEntry = record
    dwSize,
    dwfFlags: Longint;
    //
    // Device
    //
    szDeviceType: Array[0..RAS_MaxDeviceType] Of Char;
    szDeviceName: Array[0..RAS_MaxDeviceName] Of Char;
    //
    // Phone numbers
    //
    szLocalPhoneNumber: Array[0..RAS_MaxPhoneNumber] Of Char;
    dwAlternateOffset: Longint;
  end;

  LpRasCredentials = ^TRasCredentials;
  TRasCredentials = record
    dwSize,
    dwMask: Longint;
    szUserName: Array[0..UNLEN] Of Char;
    zPassword: Array[0..PWLEN ] Of Char;
    szDomain: Array[0..DNLEN] Of Char;
  end;

const

// TRasCredentials 'dwMask' values

  RASCM_UserName = $00000001;
  RASCM_Password = $00000002;
  RASCM_Domain   = $00000004;

type

// AutoDial address properties

  LPRasAutoDialEntry = ^TRasAutoDialEntry;
  TRasAutoDialEntry = record
    dwSize,
    dwFlags,
    dwDialingLocation: Longint;
    szEntry: Array[0..RAS_MaxEntryName] Of Char;
  end;


const

//  AutoDial control parameter values for
//  Ras(Get,Set)AutodialParam.

  RASADP_DisableConnectionQuery  = 0;
  RASADP_LoginSessionDisable     = 1;
  RASADP_SavedAddressesLimit     = 2;
  RASADP_FailedConnectionTimeout = 3;
  RASADP_ConnectionQueryTimeout  = 4;
{$ENDIF}


var

RasDial: Function (
	lpRasDialExtensions : PRASDIALEXTENSIONS ;	// pointer to function extensions data
	lpszPhonebook: PChar;	// pointer to full path and filename of phonebook file
	lpRasDialParams : PRASDIALPARAMS;	// pointer to calling parameters data
	dwNotifierType : DWORD;	// specifies type of RasDial event handler
	lpvNotifier: DWORD;	// specifies a handler for RasDial events
	var rasConn: HRASConn 	// pointer to variable to receive connection handle
	): DWORD; stdcall;

RasEnumConnections: Function (
	RASConn: PrasConn;		{ buffer to receive Connections data }
	var BufSize: DWord;		{ size in bytes of buffer }
	var Connections: DWord	{ number of Connections written to buffer }
	): LongInt; stdcall;

RasEnumEntries: Function (
	reserved: PChar;	// reserved, must be NULL
	lpszPhonebook: PChar  ;	// pointer to full path and filename of phonebook file
	lprasentryname: PRASENTRYNAME ;	// buffer to receive phonebook entries
	var lpcb : 	DWORD;// size in bytes of buffer
	var lpcEntries : DWORD// number of entries written to buffer
	) : DWORD; stdcall;

RasGetConnectStatus: Function (
	RASConn: hrasConn;	{ handle to Remote Access Connection of interest }
	RASConnStatus: PRASConnStatus	{ buffer to receive status data }
	): LongInt; stdcall;

RasGetErrorString: Function (
	ErrorCode: DWord;	{ error code to get string for }
	szErrorString: PChar;	{ buffer to hold error string }
	BufSize: DWord	{ sizeof buffer }
	): LongInt; stdcall;

RasHangUp: Function (
	RASConn: hrasConn	{ handle to the Remote Access Connection to hang up }
	): LongInt; stdcall;

RasGetEntryDialParams: Function (		  // ANGUS
	lpszPhonebook:PChar;	// pointer to the full path and filename of the phonebook file
	var lprasdialparams: TRASDIALPARAMS;	// pointer to a structure that receives the connection parameters
	VAR lpfPassword : BOOL	// indicates whether the user's password was retrieved
	): DWORD; stdcall;

RasSetEntryDialParams: Function (		  // ANGUS
	lpszPhonebook:PChar;	// pointer to the full path and filename of the phonebook file
	var lprasdialparams: TRASDIALPARAMS;	// pointer to a structure that contains the connection parameters
	fRemovePassword: BOOL	// // indicates whether to remove password from entry's parameters
	): DWORD; stdcall;

RasMonitorDlg: Function (
	lpszDeviceName:PChar;	// pointer to the name of the device to display initially
	VAR lprasmonitordlg:TRASRASMONITORDLG	// pointer to a structure with I/O parms
	): LongInt; stdcall;

RasEditPhonebookEntry: Function (	 // ANGUS
	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; stdcall;

RasCreatePhonebookEntry: Function (	// ANGUS
	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; stdcall;

RasGetProjectionInfo: Function (	// ANGUS
	hConn: HRasConn;
	rasproj: TRasProjection;
	lpProjection: Pointer;
	var lpcb: Longint
	): Longint; stdcall;

RasGetCountryInfo: Function (	// ANGUS  -  from RNAPH.DLL
	var lpCtryInfo: TRasCtryInfo;
	var lpdwSize: Longint
	): Longint; stdcall;

RasGetEntryProperties: Function (	// ANGUS	 -  from RNAPH.DLL
	lpszPhonebook,
	szEntry: PChar;
	  lpbEntry: Pointer;
	var lpdwEntrySize: Longint;
	lpbDeviceInfo: Pointer;
	var lpdwDeviceInfoSize: Longint
	): Longint; stdcall;

RasSetEntryProperties: Function (	// ANGUS	-  from RNAPH.DLL
	lpszPhonebook,
	szEntry: PChar;
	  lpbEntry: Pointer;
	dwEntrySize: Longint;
	lpbDeviceInfo: Pointer;
	dwDeviceInfoSize: Longint
	): Longint; stdcall;

RasRenameEntry: Function (	// ANGUS		 -  from RNAPH.DLL
	lpszPhonebook,
	szEntryOld,
	szEntryNew: PChar
	): Longint; stdcall;

RasDeleteEntry: Function (	// ANGUS		  -  from RNAPH.DLL
	lpszPhonebook,
	szEntry: PChar
	): Longint; stdcall;

RasValidateEntryName: Function (	// ANGUS	 -  from RNAPH.DLL
	lpszPhonebook,
	szEntry: PChar
	): Longint; stdcall;

RasEnumDevices: Function (	// ANGUS	  -  from RNAPH.DLL
	lpBuff: PRasDevInfo;
	var lpcbSize: Longint;
	var lpcDevices: Longint
	): Longint; stdcall;

// following functions are NT4 only
{$IFDEF NT_EXTNS}

RasGetSubEntryHandle: Function (  	// ANGUS     - NT4 only
    hrasconn: HRasConn;
    dwSubEntry: Longint;
    var lphrasconn: HRasConn
    ): Longint; stdcall;

RasGetCredentials: Function (  	// ANGUS     - NT4 only
    lpszPhoneBook,
    lpszEntry: PChar;
    var lpCredentials: TRasCredentials
    ): Longint; stdcall;

RasSetCredentials: Function (  	// ANGUS     - NT4 only
    lpszPhoneBook,
    lpszEntry: PChar;
    var lpCredentials: TRasCredentials;
    fRemovePassword: LongBool
    ): Longint; stdcall;

RasConnectionNotification: Function (  	// ANGUS     - NT4 only
  hrasconn: HRasConn;
  hEvent: THandle;
  dwFlags: Longint
  ): Longint; stdcall;

RasGetSubEntryProperties: Function (  	// ANGUS     - NT4 only
    lpszPhoneBook,
    lpszEntry: PChar;
    dwSubEntry: Longint;
    var lpRasSubEntry: TRasSubEntry;
    var lpdwcb: Longint;
    p: Pointer;
    var lpdw: Longint
    ): Longint; stdcall;

RasSetSubEntryProperties: Function (  	// ANGUS     - NT4 only
    lpszPhoneBook,
    lpszEntry: PChar;
    dwSubEntry: Longint;
    var lpRasSubEntry: TRasSubEntry;
    dwcb: Longint;
    p: Pointer;
    dw: Longint
    ): Longint; stdcall;

RasGetAutodialAddress: Function (  	// ANGUS     - NT4 only
    lpszAddress: PChar;
    lpdwReserved: Pointer;
    lpAutoDialEntries: LPRasAutoDialEntry;
    var lpdwcbAutoDialEntries: Longint;
    var lpdwcAutoDialEntries: Longint
    ): Longint; stdcall;

RasSetAutodialAddress: Function (  	// ANGUS     - NT4 only
    lpszAddress: PChar;
    dwReserved: Longint;
    lpAutoDialEntries: LPRasAutoDialEntry;
    dwcbAutoDialEntries: Longint;
    dwcAutoDialEntries: Longint
    ): Longint; stdcall;

RasEnumAutodialAddresses: Function (  	// ANGUS     - NT4 only
    lppAddresses: Pointer;
    var lpdwcbAddresses: Longint;
    var lpdwAddresses: Longint
    ): Longint; stdcall;

RasGetAutodialEnable: Function (  	// ANGUS     - NT4 only
    dwDialingLocation: Longint;
    var lpfEnabled: LongBool
    ): Longint; stdcall;

RasSetAutodialEnable: Function (  	// ANGUS     - NT4 only
    dwDialingLocation: Longint;
    fEnabled: LongBool
    ): Longint; stdcall;

RasGetAutodialParam: Function (  	// ANGUS     - NT4 only
    dwKey: Longint;
    lpvValue: Pointer;
    var lpdwcbValue: Longint
    ): Longint; stdcall;

RasSetAutodialParam: Function (  	// ANGUS     - NT4 only
    dwKey: Longint;
    lpvValue: Pointer;
    dwcbValue: Longint
    ): Longint; stdcall;

{$ENDIF}


const
  RASAPI_DLL = 'RASAPI32.DLL';	// Angus - WinNT needs file extension
  RNAPH_DLL  = 'RNAPH.DLL';		// Angus - functions may be in rasapi32

implementation

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -